#36575: Document logout link workaround with a better URL name --------------------------+----------------------------------------- Reporter: adehnert | Type: Uncategorized Status: new | Component: Documentation Version: 5.1 | Severity: Normal Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------+----------------------------------------- The Django 4.1 release notes mention:
If you want to retain the user experience of an HTML link, you can use a form that is styled to appear as a link: {{{ <form id="logout-form" method="post" action="{% url 'admin:logout' %}"> {% csrf_token %} <button type="submit">{% translate "Log out" %}</button> </form> }}} However, the `admin:logout` view appears to require the the user have admin access (at least, empirically, my user that doesn't gets redirected to `/admin/` and then `/admin/login/`). The plain `logout` URL name (https://docs.djangoproject.com/en/5.2/topics/auth/default/#django.contrib.auth.views.LogoutView), which doesn't require this, seems like a better fit. (Relatedly, this information seems pretty timeless -- should it be included in say the docs for LogoutView, rather than just some increasingly-old release notes? Presumably somebody writing a brand-new Django 5.2 app *also* wants to know how to make a logout link. I spent a bit looking around the docs and don't see it mentioned anywhere -- actually, I was a little surprised that the tutorial doesn't obviously mention extending base templates and provide a sample template with a login link, logout link, etc..) -- Ticket URL: <https://code.djangoproject.com/ticket/36575> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/django-updates/01070198e911411a-fcf11e0c-32db-4d76-97d4-207e3dd387b9-000000%40eu-central-1.amazonses.com.