Anonymous
Hey guys, I am using Token authentication to generate access_token when logining in through my Android app. When I try to send a post request from the Android app using the access_token, I get csrf verification failed error which is strange since with token authentication csrf token is not needed.
Anonymous
When I add the csrf_exempt to my code it gives an attribute error saying wsgi request has no attribute none
Anonymous
saying wsgi request has no attribute 'auth'
Anonymous
Not none, sorry
Ghorz
Not none, sorry
Show your code on pastebin
𝕬𝖗𝖙𝖊𝖒
Hi, guys. Can you help me? I made an endpoint with GET and PUT methods. But because of an unknown problem, PUT is working, GET neither(404 error with message: {'detail': 'not found'}, but I see this in Swagger). Code of a viewset of the endpoint: https://pastebin.com/bKZukhj1 URL path looks like https://pastebin.com/DC67gpmK P.S. In the serializer there is the only meta.
Anonymous
Sending media to the group is blocked, pls should I send to your dm?
Anonymous
🙏pls how can I access pastebin, I don't know what it is
Anonymous
Ok thanks
Anonymous
My code
foxyy999
hey guys, last night i deploy my project on heroku and upload the images, it was working fine but on morning heroku does not showing images that i uploaded but my admin panel have the images on database. and my staticfiles making the copy of every image heres my project link : https://my-site-ecommerce.herokuapp.com/
Anonymous
Heroku can't store images
foxyy999
Then why last night it's showing the images and I even use whitenoise
Mehmet
There is a "/app/static/images/shoes2.jpg does not exist" error for an image.
foxyy999
how did you get https?
i open my site by heroku open on terminal
Bunty chhatri wala..
Using path How to make a url like this: localhost:8000/postcodes/?postcode=8000&radius=90 Basically I'm trying rest api.. Which can accept data from a user..like above..
foxyy999
There is a "/app/static/images/shoes2.jpg does not exist" error for an image.
i saw that error but my django admin have the files and i dont know why its showing this error
Bunty chhatri wala..
i saw that error but my django admin have the files and i dont know why its showing this error
Heroku cant serve User Uploaded media files..for that u might need Aws S3.
Bunty chhatri wala..
If the images are static.. then it will work..but wont work on user uploaded media files
bitwise
Page not found (404) Request Method:GETRequest URL:https://my-site-ecommerce.herokuapp.com/images/shoes2.jpgRaised by:django.views.static.serve “/app/static/images/shoes2.jpg” does not exist You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Bunty chhatri wala..
Using path How to make a url like this: localhost:8000/postcodes/?postcode=8000&radius=90 Basically I'm trying rest api.. Which can accept data from a user..like above.. You know something about this?
Ghorz
https://pastebin.com/bkLdGDta
On line 71,did you import csrf_exempt
Bunty chhatri wala..
I tried..but its like xyz.com/post/location.. But i dont want a url like this.
bitwise
Bunty chhatri wala..
I'm trying a rest api with single endpoint.. No forms concept.. Only a get request from url
bitwise
I'm trying a rest api with single endpoint.. No forms concept.. Only a get request from url
then do one thing check for query parameters in url if query param have location and postcode do stuff else bad request
Bunty chhatri wala..
Ok
Bunty chhatri wala..
Let me try
Bunty chhatri wala..
Thank you :)
Anonymous
On line 71,did you import csrf_exempt
Yh I imported csrf_exmept and applied it to all my functions which involves GET requests in order to prevent that csrf verification. I didn't apply to functions which are for POST requests because I am using rest_framework Token authentication for them
Anonymous
I except tokens to be passes with Authorization headers when making a POST requests.
Anonymous
@himanshi_kat if you can't tackle the issue, try to store your images to AWS
foxyy999
Thanx everyone
Anonymous
👍
𝕬𝖗𝖙𝖊𝖒
Dexter
Which is best way to create views class or function and what is the main difference
Ghorz
Which is best way to create views class or function and what is the main difference
Which way do you know and have used, tell us which you think is this best
Abdul
Hello, i am getting a NoReverseMatch error in my app, necessary files and error message are in https://hastebin.com/veyokexate.xml . Thank you in advance.
Can anyone please help me on this error, I'm getting a NoReverseMatch error I have tried everything I can think of...
Abdul
Which is best way to create views class or function and what is the main difference
I think you can achieve a lot, with lesser code if you use class based views especially if you stick to the convention.
Shubham
Or even in url block if you are using django template
Abdul
Make sure the url's name is used inside the reverse
I didn't define the reverse myself, I think Django does that for me.
Shubham
Yes in django template you must be using {% url 'url_name' %}
Shubham
Yes in django template you must be using {% url 'url_name' %}
If that url has any pk or anything that it accepts than make sure to pass that from here. Otherwise you'll get NoReverseMatch error
Syanty
Try adding app_name = "yourappname" before urlpatterns And While calling in template Use {% url 'yourappname: listing-detail' listing.id %}
Syanty
This way works for me
Abdul
I'll try that, thanks.
SiddiqNx™
Hey everyone. How do you manage timezone conversions in Django? Especially in Rest API? And when a client sends a POST request, do you convert dates in the client side or in the server side? Any standard method for handling this?
Anonymous
Apply it
I did and got WSGI attribute error: saying 'auth' doesn't exist
Anonymous
I want to call Twitter api and fetch last 7 days of tweets for any hashtag Can anyone give me example please.
SMC
Bro's How can I save the href link and text when I click on one of the links of collection which is scraped and display on screen. Now the text and link address which I clicked should be useful in another html page . How can I do it ? Please help me regarding this .
SMC
Bro's How can I save the href link and text when I click on one of the links of collection which is scraped and display on screen. Now the text and link address which I clicked should be useful in another html page . How can I do it ? Please help me regarding this .
For example: 20 links are displayed on screen which was rendered by some X text by for loop. Suppose I click on first text(background link) then I have to display the text and link address on another html page
Pandu
I need some help with modifying my Django Admin. I have a 'Bookstore' model which has Four fields: title, author, status and date_borrowed **The status field is a select field containing two values: 'Available' and 'Borrowed' What I am trying to achieve is: When you select the status of the Book as 'Available', the 'date_borrowed' field is still visible. However when you select 'Borrowed', the 'date_borrowed' field should be hidden. I've tried googling online with many results but nothing has worked out. The closest I got was this link (https://stackoverflow.com/questions/47838059/django-admin-show-hide-fields-if-specific-value-is-selected-in-a-dropdown) But so far no luck. Here is the project on Github. It's very basic, just Django (no other packages installed) The Project: https://github.com/fredricksimi/sampleproject/
Pandu
Is it possible in Admin panel also?
SmQ
Yes, open admin panel and browser's developer tools, target the specific field, you can easily get your desired div, add this inline to the admin panel html
Pandu
Thanks I'll try👍
SmQ
Just locate the admin panel template in your project, and you are set
Anonymous
How can i implement a permission where only the owner/author can edit and delete something and anyone can view with token authentication?