G
G
grecigor252021-07-12 03:19:24
Django
grecigor25, 2021-07-12 03:19:24

Django, how to work with the User correctly?

Let's say I made a regu + login by login, I have a dictionary of words, each user has his own words, everything is done here.

How can I find out the ID of the user who entered this dictionary so that I can display only his words? Suppose in the same telegram we pull the ID from the database, work from the bottom, return the result, but how? I can't find any info, maybe there is some kind of decorator for this or something like that, I only know about login_reuquired, but it's not like that.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Deleting Account, 2021-07-12
@Andriy_Kosmenyuk

If authentication is not via jwt, then in Django, as I remember, there is a global variable request with which you can take data for authorization
Here:
https://docs.djangoproject.com/en/3.2/topics/class...
https://stackoverflow .com/questions/12615154/how-t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question