Opened 10 years ago
Closed 10 years ago
#24553 closed New feature (fixed)
Pass application list to more admin views
Reported by: | rm_ | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | admin |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Pass the list of available applications to more views so it is possible to show a menu with them.
Discussion on list:
https://groups.google.com/forum/#!searchin/django-developers/having$20the$20app/django-developers/SLwh7zJmkTQ/RPUABdNYuCIJ
Change History (20)
comment:1 by , 10 years ago
follow-up: 4 comment:2 by , 10 years ago
It might be a use case for AdminSite.each_context()
. Could we merely add the AdminSite.get_app_list()
method (called build_app_list()
in your patch) and allow users to override AdminSite.each_context()
if they want that available in all their contexts?
comment:3 by , 10 years ago
Patch needs improvement: | set |
---|
comment:4 by , 10 years ago
Replying to timgraham:
It might be a use case for
AdminSite.each_context()
. Could we merely add theAdminSite.get_app_list()
method (calledbuild_app_list()
in your patch) and allow users to overrideAdminSite.each_context()
if they want that available in all their contexts?
My plan is to consume this data on django theme and really much like to have it work out of the box without requiring user intervention. If that's not possible i'll go with the each_context() route.
Settings needs better patch because some tests are failing.
comment:5 by , 10 years ago
Patch needs improvement: | unset |
---|
Tests passes, the docs test not passing i think is not related to the patchset as in some runs it did pass. One thing i am wondering about is to don't call build_app_list() if is_popup() is true since it does not make much sense to add it inside a popup. Flipping the needs improvement bits to get some review exposure. What do you think?
comment:6 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:7 by , 10 years ago
Patch needs improvement: | set |
---|
comment:8 by , 10 years ago
Patch needs improvement: | unset |
---|
comment:9 by , 10 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:11 by , 10 years ago
Has patch: | unset |
---|---|
Resolution: | fixed |
Status: | closed → new |
Triage Stage: | Ready for checkin → Accepted |
Reopening due to test failures reported in #24798.
comment:12 by , 10 years ago
Has patch: | set |
---|
Opened pull request here:
https://github.com/django/django/pull/4659
comment:14 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:15 by , 10 years ago
Has patch: | unset |
---|---|
Resolution: | fixed |
Status: | closed → new |
Still seeing two test failures with $ ./runtests.py auth_tests
comment:16 by , 10 years ago
Looking into this, it looks like all the test without custom AdminSite leaks auth models in the site breaking the two test classes using custom ROOT_URLCONF that are failing.
comment:17 by , 10 years ago
There appears to be leakage of the URLs from tests/auth_tests/urls.py
into tests that use ROOT_URLCONF='auth_tests.test_urls_admin'
. Couldn't find the reason for this but traced it as far as RegexURLResolver.urlconf_module which shows leakage with this version:
@property def urlconf_module(self): if isinstance(self.urlconf_name, six.string_types): module = import_module(self.urlconf_name) patterns = getattr(module, "urlpatterns") print('---- %s ---- %s ' % (self.urlconf_name, patterns)) return module else: return self.urlconf_name
and:
$ ./tests/runtests.py auth_tests.test_views.ChangePasswordTest.test_password_change_fails_with_invalid_old_password auth_tests.test_views.ChangelistTests.test_user_change_password
While the second test is executing, you'll see the URLs from the first test.
Because the default admin site is leaking into the second test, its logout view is being called (AdminSite.name
is 'admin' instead of 'auth_test_admin').
comment:18 by , 10 years ago
Has patch: | set |
---|
Got it! PR here https://github.com/django/django/pull/4675
comment:20 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Pull request:
https://github.com/django/django/pull/4410