#20934: NoReverseMatch on ModelAdmin.changelist_view if appname_modelname_change
url is removed from get_urls
-------------------------------+--------------------
     Reporter:  koirikivi      |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  Uncategorized  |    Version:  master
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Accessing the {{{changelist_view}}} of a {{{ModelAdmin}}} subclass results
 in a {{{NoReverseMatch}}} error if {{{get_urls}}} is overridden so that
 the "appname_modelname_change" url is removed, but
 "appname_modelname_changelist" is left untouched.

 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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.744e19f886360f397c330cc45f36b537%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to