#24931 closed Bug (fixed)
404 error for "Views by namespace admin" at Admin Docs
| Reported by: | Girish | Owned by: | Markus Holtermann |
|---|---|---|---|
| Component: | Core (URLs) | Version: | dev |
| Severity: | Normal | Keywords: | Admin, AdminDocs, urlresolver |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I am currently running the master version of the django github project (on 5th Jun 2015 10:46 am).
I followed the instructions (https://docs.djangoproject.com/en/dev/ref/contrib/admin/admindocs/)
to install the admin docs to my django application. Don't forget to install docutils using pip.
If you go the following url (Admin doc):
http://127.0.0.1:8000/admin/doc/
and choose Views and you should get to http://127.0.0.1:8000/admin/doc/views/
there you should find two section
- Views by empty namespace
- Views by namespace admin
the links to Views by empty namespace works fine but Views by namespace admin leads to
404 error.
Change History (13)
comment:1 by , 10 years ago
| Description: | modified (diff) |
|---|---|
| Type: | Uncategorized → Bug |
comment:2 by , 10 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 10 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:4 by , 10 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:6 by , 10 years ago
I believe the problem might be due to the fact that those views are actually methods of django.contrib.admin.sites.AdminSite.
comment:7 by , 10 years ago
| Owner: | changed from to |
|---|
comment:8 by , 10 years ago
I think I've spotted where the issue comes from. When you use namespaced urls on your ROOT_URL_CONF you will have RegexURLResolver instances in your patterns, but the _callback_strs are not properly added, maybe it's better to show you a snippet from the actual code on django.core.urlresolvers at version 1.8.4 (I added the comment at the end)
if isinstance(pattern, RegexURLResolver):
if pattern.namespace:
namespaces[pattern.namespace] = (p_pattern, pattern)
if pattern.app_name:
apps.setdefault(pattern.app_name, []).append(pattern.namespace)
else:
parent_pat = pattern.regex.pattern
for name in pattern.reverse_dict:
for matches, pat, defaults in pattern.reverse_dict.getlist(name):
new_matches = normalize(parent_pat + pat)
lookups.appendlist(
name,
(
new_matches,
p_pattern + pat,
dict(defaults, **pattern.default_kwargs),
)
)
for namespace, (prefix, sub_pattern) in pattern.namespace_dict.items():
namespaces[namespace] = (p_pattern + prefix, sub_pattern)
for app_name, namespace_list in pattern.app_dict.items():
apps.setdefault(app_name, []).extend(namespace_list)
self._callback_strs.update(pattern._callback_strs) # This should be done even if a namespace is specified I think
comment:9 by , 9 years ago
| Component: | contrib.admindocs → Core (URLs) |
|---|---|
| Has patch: | set |
| Keywords: | urlresolver added |
| Owner: | changed from to |


I'll take a look at it.