admin_view does extra stuff like calling the admin site's get_permission method and using the admin login page rather than the default auth one: https://github.com/django/django/blob/98d3fd61026457a435ef5b7afce6b6e64e9f241d/django/contrib/admin/sites.py#L198
It should indeed be used only for admin pages. On Tue, 9 Mar 2021 at 11:04, Carlton Gibson <carlton.gib...@gmail.com> wrote: > Hi Tobias. > > I’ve always taken it that @staff_member_required is for decorating views > that aren’t part of the admin, and so not accessed via > AdminSite.get_urls(). > > I don’t think I’d use AdminSite.admin_view() outside of the context in the > example there. > I can’t think why one would do that… 🤔 — no doubt someone does 🙂 > > Kind Regards, > > Carlton > > > > On 9 Mar 2021, at 11:56, Tobias Bengfort <tobias.bengf...@posteo.de> > wrote: > > > > Hi, > > > > while reading the documentation on django's admin site I noticed there > are two mechanisms to check for authentication: AdminSite.admin_view[0] and > staff_member_required[1]. I am not sure when I should use which of them. > > > > So what is the difference between the two? I expect that > staff_member_required is more low-level and I should use > AdminSite.admin_view in most cases. Is that correct? > > > > I will try to make a pull request to add the answer to the documentation. > > > > thanks > > tobias > > > > > > [0]: > https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls > > [1]: > https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#the-staff-member-required-decorator > > > > -- > > You received this message because you are subscribed to the Google > Groups "Django developers (Contributions to Django itself)" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to django-developers+unsubscr...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/cb52dfda-67e4-a336-4eea-39195d6f8bb3%40posteo.de > . > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/67A3688D-41C0-4E14-B235-51482689D285%40gmail.com > . > -- Adam -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM0DraaK372CuuwueqJqBieiTvmQbkwNVH8ABBr1ksURRA%40mail.gmail.com.