Skip to content

Tag: django

Django Rest Framework JWT Unit Test

I am using DRF with the JWT package for authentication. Now, I’m trying to write a unit test that authenticates itself with a JWT token. No matter how I try it, I can’t get the test API client to authenticate itself via JWT. If I do the same with an API client (in my case, Postman), everything wor…

Auto Fill User In Django Form

In my project as soon as user signup it is redirected to update view where he has to fill this information.Since the user has also logged in automatically after signup I want that user field to be filled automatically and can’t be edited. models.py forms.py views.py All the required libraries are import…

django ‘str’ object has no attribute ‘_meta’

Sorry for my English. I have some data from another server, but I need to output this data like JSON. if i print response in console: but, if i return this response like HttpResponse i have an error AttributeError: ‘str’ object has no attribute ‘_meta’ this my code: UPD: I tried with t…

Django: Gmail SMTP error: please run connect() first

I am trying to send mail when a certain query is executed. But I am getting error in the connection. I have tried the following settings in my settings.py file I have executed the following command to send the email: But whenever I run the above code I get ‘please run connect() first’ error. What …