Opened 9 years ago

Closed 9 years ago

#25472 closed Cleanup/optimization (wontfix)

docs of login_required() should show the usage in class-based-views.

Reported by: Thomas Güttler Owned by: nobody
Component: Documentation Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Thomas Güttler)

The docs of login_required() should show the usage in class-based-views.

This pattern seems common:

urlpatterns = [
    url(r'^about/', login_required(TemplateView.as_view(template_name="secret.html"))),

from: https://docs.djangoproject.com/en/1.8/topics/class-based-views/intro/#decorating-in-urlconf

Please update the docs: https://docs.djangoproject.com/en/1.8/topics/auth/default/#django.contrib.auth.decorators.login_required

Since class-based views are the default today, I think it would be appropriate to list the class-based-view way first, and then list the decorating of view-methods.

Change History (3)

comment:1 by Thomas Güttler, 9 years ago

Summary: docs fordocs of login_required() should show the usage in class-based-views.

comment:2 by Thomas Güttler, 9 years ago

Description: modified (diff)

comment:3 by Tim Graham, 9 years ago

Resolution: wontfix
Status: newclosed

Thanks for the suggestion. On Django 1.9, you can use the LoginRequiredMixin instead and this is documented after the login_required() decorator in that documentation. I don't think the issue is critical enough that we need to patch the docs for 1.8.

Note: See TracTickets for help on using tickets.
Back to Top