V
V
Vladisus2015-05-27 22:53:36
Django
Vladisus, 2015-05-27 22:53:36

How to access login_required url?

There means url:

url(r'^links$', login_required(views.LinkListView.as_view()), name='links')

and view:
class LinkListView(ListView):
    model = Link
    template_name = "app/links.html"

in html: I'm getting an error Already googled that it's so easy not to access the login_required url, but I didn't find a clear answer.
href="{% url 'links' %}"
NoReverseMatch

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2015-05-27
@deliro

url(r'^links$', login_required(views.LinkListView.as_view(), login_url=reverse_lazy('your_login_url')), name='links')

In general, it’s more beautiful to put it in a mixin.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question