Ticket #4641: 4641.diff

File 4641.diff, 790 bytes (added by Karen Tracey <kmtracey@…>, 17 years ago)

This patch also works for the case where the primary key field is not named 'id'

  • django/contrib/admin/widgets.py

     
    9999        output.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % \
    100100            (related_url, url, name))
    101101        output.append('<img src="%simg/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>' % settings.ADMIN_MEDIA_PREFIX)
     102        if value:
     103            output.append('&nbsp;<strong>%s</strong>' % self.rel.to.objects.get(pk=value))       
    102104        return u''.join(output)
    103105        #if self.change: # TODO
    104106            #output.append('&nbsp;<strong>TODO</strong>')
Back to Top