F
F
From Prog2022-04-08 18:50:38
Django
From Prog, 2022-04-08 18:50:38

How to pass value between pages in django?

I want to make such a concept of the site, in which there will be no registration and only one secret word will be required for entry, which is entered into the form on the first page of the site. But then the problem arises: how to pass data from the form to all further pages? It is necessary that on each page of the site the username is displayed in the upper left corner. The main question is how to pass data between pages using the "a" tag?

Just in case, the login form code:

<form id='login_form' method='post'>
    {% csrf_token %}
    <p id='info_in_login'>Ниже введите секретное слово, для его получения напишите <a href="https://telegram.com" id='link_to_telegram' target='_blank'>сюда</a></p>
    <div>
        <input required type="text" name="secret_word" id='entering_secret_word'>
    </div>
    <div>
        <button type="submit" id='submit_button'>Войти</button>
    </div>
</form>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2022-04-08
@bacon

https://docs.djangoproject.com/en/4.0/topics/auth/...

K
kvarel, 2022-04-10
@kvarel

You can rewrite the authorization backend. There is one user in the database, and authorization is not by login password, but by the selected field

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question