[Django] #33221: AdminSite each_context collected app_list always, for every user and view

17 views
Skip to first unread message

Django

unread,
Oct 22, 2021, 12:09:09 PM10/22/21
to django-...@googlegroups.com
#33221: AdminSite each_context collected app_list always, for every user and view
-------------------------------------+-------------------------------------
Reporter: Maxim | Owner: nobody
Danilov |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 3.2
contrib.admin |
Severity: Normal | Keywords: admin, AdminSite
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
AdminSite each_context collected app_list always.

It means it works for all user, dont matter is anonymous or not. But it
should work only for internal admin pages.

This views probably should not to call each_context or collect app_list
ewery time:

autocomplete/
jsi18n/
login/
logout/

I dont know about "view_on_site" view.

Right now i put something like this:
{{{
def get_app_list(self, request):
return super(AdminSite, self).get_app_list(request) if
request.user.is_authenticated else []
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33221>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 23, 2021, 12:36:22 AM10/23/21
to django-...@googlegroups.com
#33221: AdminSite each_context collected app_list always, for every user and view
-------------------------------------+-------------------------------------
Reporter: Maxim Danilov | Owner: Vishal
Type: | Pandey
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution:

Keywords: admin, AdminSite | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Vishal Pandey):

* owner: nobody => Vishal Pandey
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33221#comment:1>

Django

unread,
Oct 25, 2021, 1:59:42 AM10/25/21
to django-...@googlegroups.com
#33221: AdminSite.each_context() collected app_list always, for every user and
view.

-------------------------------------+-------------------------------------
Reporter: Maxim Danilov | Owner: Vishal
Type: | Pandey
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution: wontfix

Keywords: admin, AdminSite | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => closed
* resolution: => wontfix
* easy: 1 => 0


Comment:

Thanks for this proposition, however it's clearly
[https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.AdminSite.each_context
documented] that `each_context()` ''"Returns a dictionary of variables to
put in the template context **for every page in the admin site**..."''. I
don't think it's worth backward compatibility concerns.

--
Ticket URL: <https://code.djangoproject.com/ticket/33221#comment:2>

Reply all
Reply to author
Forward
0 new messages