S
S
Sergey Nizhny Novgorod2017-07-11 05:10:04
Django
Sergey Nizhny Novgorod, 2017-07-11 05:10:04

How to refresh blocks with permissions after Ajax authorization requests?

Hello everyone
On the page there are a number of elements that look like this:

{% if user.is_authenticated %}
    <li><a href="{% url "profile" user.id %}">Профиль</a></li>
    <li><a href="{% url "logout" %}">Выйти</a></li>
{% else %}
    <li><a href="{% url "login" %}">Войти</a></li>
    <li><a href="{% url "registration" %}">Регистрация</a></li>
{% endif %}

Those. data output depends on user authorization.
I am writing an ajax request that authorizes the user without reloading the page, how can I refresh these blocks?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Shubin, 2017-07-11
@idegree

Kostylno:
Judging by the fact that you want to login without reloading the page, use some JS framework on the Front-End (Angular, React, Vue, Ember).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question