#19554: ChangeList.url_for_result iwork only for "admin" Site
--------------------------------+------------------------------------------
     Reporter:  tecnosegugio@…  |      Owner:  nobody
         Type:  Uncategorized   |     Status:  new
    Component:  contrib.admin   |    Version:  1.5-beta-1
     Severity:  Normal          |   Keywords:  Admin, AdminSite, ChangeList
 Triage Stage:  Unreviewed      |  Has patch:  0
Easy pickings:  0               |      UI/UX:  0
--------------------------------+------------------------------------------
 In django/contrib/admin/views/main.py the ChangeList.url_for_result method
 contains a format string with an hardcode "admin:".
 With this string it's hard to get the correct URLs in a result list in an
 Admin Site different than the default.

 As a workaround, I've edited the method as follow:

 {{{
 def url_for_result(self, result):
     pk = getattr(result, self.pk_attname)
     return reverse('%s:%s_%s_change' % (     # edited the format string
         self.model_admin.admin_site.name,    # added this parameter
         self.opts.app_label,
         self.opts.module_name),
         args=(quote(pk),),
         current_app=self.model_admin.admin_site.name
     )
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19554>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to