Example ModelAdmin subclass causing this error:
{{{
class UnchangeableModelAdmin(admin.ModelAdmin):
model = models.UnchangeableModel
def get_urls(self):
# return the standard urls, except for the change url
urlpatterns0 = super(UnchangeableModelAdmin, self).get_urls()
return [p for p in urlpatterns0 if not p.name.endswith("_change")]
}}}
Traceback points to line 91 in
{{{django/contrib/admin/templates/admin/change_list.html}}}, namely the
{{{ result_list}}} template tag.
Related issue: #20640
--
Ticket URL: <https://code.djangoproject.com/ticket/20934>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Created a test project to verify this bug and #20640:
https://github.com/koirikivi/django-admin-views-test
--
Ticket URL: <https://code.djangoproject.com/ticket/20934#comment:1>
* component: Uncategorized => contrib.admin
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/20934#comment:2>
* status: new => assigned
* owner: nobody => koirikivi
--
Ticket URL: <https://code.djangoproject.com/ticket/20934#comment:3>
* has_patch: 0 => 1
Comment:
Topic branch at https://github.com/koirikivi/django/tree/ticket_20934
Pull request at https://github.com/django/django/pull/1499
Tests pass under sqlite and postgresql
--
Ticket URL: <https://code.djangoproject.com/ticket/20934#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"65cf82bd08631a7aa8d9dd007b2527476fa3304f"]:
{{{
#!CommitTicketReference repository=""
revision="65cf82bd08631a7aa8d9dd007b2527476fa3304f"
Fixed #20934 -- Avoided NoReverseMatch in ModelAdmin.changelist_view
The view tried to display links to a ModelAdmin's change_view, which
resulted in NoReverseMatches if get_urls was overridden to remove the
corresponding url.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20934#comment:5>