Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-15 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
in/sites.py#L196 >>> >>> On Tue, Mar 9, 2021 at 9:45 PM Matthew Pava wrote: >>> >>>> > Thoughts on deprecating it? >>>> >>>> It seems like a good idea. However, it leads us to another question. Do >>>> we reall

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-13 Thread Kevin Grinberg
t;> >>> >>> *From:* django-d...@googlegroups.com *On >>> Behalf Of *Timothy McCurrach >>> *Sent:* Tuesday, March 9, 2021 3:22 PM >>> *To:* django-d...@googlegroups.com >>> *Subject:* Re: Difference between AdminSite.admin_view and >>> staff_me

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-13 Thread Ian Foote
the is_staff field on the User Model if it is deprecated? >> >> >> >> *From:* django-developers@googlegroups.com < >> django-developers@googlegroups.com> *On Behalf Of *Timothy McCurrach >> *Sent:* Tuesday, March 9, 2021 3:22 PM >> *To:* django-developer

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Timothy McCurrach
rs@googlegroups.com < > django-developers@googlegroups.com> *On Behalf Of *Timothy McCurrach > *Sent:* Tuesday, March 9, 2021 3:22 PM > *To:* django-developers@googlegroups.com > *Subject:* Re: Difference between AdminSite.admin_view and > staff_member_required? > > &

RE: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Matthew Pava
ngo-developers@googlegroups.com Subject: Re: Difference between AdminSite.admin_view and staff_member_required? staff_member_required feels like a bit of a relic from the past: - It looks like before a massive refactor of the admin that happened 12 years ago (https://github.com/django/django/com

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Timothy McCurrach
staff_member_required feels like a bit of a relic from the past: - It looks like before a massive refactor of the admin that happened 12 years ago ( https://github.com/django/django/commit/a19ed8aea395e8e07164ff7d85bd7dff2f24edca) staff_member_required played a similar role to what

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Tobias Bengfort
On 09/03/2021 18.03, Carlton Gibson wrote: Do you want to open a PR with suggested changes as a focus for discussion? I would open a PR that improves the docs, but I still don't understand the difference, so I wouldn't know what to write. The other alternative would be remove one of them,

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Carlton Gibson
Hey Tobias. OK, it looks like I need to review it in more depth. Possibly it does all make sense, but the staff_member_required docs don’t read how I’d expect them to from this conversation. Do you want to open a PR with suggested changes as a focus for discussion? Kind regards, Carlton On

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Tobias Bengfort
I checked the git logs and learned about a neat git feature: git log -L ':staff_member_required:django/contrib/admin/views/decorators.py git log -L ':admin_view:django/contrib/admin/sites.py (requires `*py diff=python` in .gitattributes) The last commit to admin_view was in 2009. The last

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Carlton Gibson
Hi. > On 9 Mar 2021, at 14:33, Tobias Bengfort wrote: > > According to [0] ... > > [0] > https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#the-staff-member-required-decorator Those docs are unchanged since they were added 6 years ago.

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Tobias Bengfort
Hi, On Tue, 9 Mar 2021 at 11:04, Carlton Gibson wrote: > 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(). On 09/03/2021 13.21, Adam Johnson wrote: admin_view does extra stuff like calling

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
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

Re: Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Carlton Gibson
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… 樂 —

Difference between AdminSite.admin_view and staff_member_required?

2021-03-09 Thread Tobias Bengfort
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