L
L
Lolo Penguin2019-11-25 20:27:37
Django
Lolo Penguin, 2019-11-25 20:27:37

How can I check if such an entry already exists in the database?

I have a user registered, I redirected him to the login page. But I don’t know how to check if there is such a user or not (i.e. connect to the database, if both the login and password match, then redirect to the personal account, if they don’t match, then it gives an error).
Help plz

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Gilfanov, 2019-11-25
@ledo02

For answers to both questions, see the following sections in the Django documentation:
On the first link you can find how to check the existence of a record in the database. But I don't think you need it now.
On the second link, you can find how to make a custom view (view) for user authorization and check if the user is authorized in other views.
Google Translate and/or Yandex.Translate to help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question