Opened 3 years ago

Closed 3 years ago

#19554 closed Uncategorized (invalid)

ChangeList.url_for_result work only for "admin" Site

Reported by: tecnosegugio@… Owned by: nobody
Component: contrib.admin Version: 1.5-beta-1
Severity: Normal Keywords: Admin, AdminSite, ChangeList
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


In django/contrib/admin/views/ 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,    # added this parameter

Change History (2)

comment:1 Changed 3 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from ChangeList.url_for_result iwork only for "admin" Site to ChangeList.url_for_result work only for "admin" Site

comment:2 Changed 3 years ago by rafales

  • Resolution set to invalid
  • Status changed from new to closed

current_app argument decides what instance of admin site is being used. admin in format string is application name, not an instance name.

Note: See TracTickets for help on using tickets.
Back to Top