Ticket #7923: admin-rawid-link.diff

File admin-rawid-link.diff, 788 bytes (added by Julian Bez, 16 years ago)
  • django/contrib/admin/widgets.py

     
    118118        return mark_safe(u''.join(output))
    119119   
    120120    def label_for_value(self, value):
    121         return '&nbsp;<strong>%s</strong>' % \
    122             truncate_words(self.rel.to.objects.get(pk=value), 14)
     121        obj = self.rel.to.objects.get(pk=value)
     122        return '&nbsp;<strong><a href="../../../%s/%s/%s/">%s</a></strong>' % \
     123            (obj._meta.app_label,
     124             obj._meta.object_name.lower(),
     125             obj.pk,
     126             truncate_words(obj, 14))
    123127           
    124128class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
    125129    """
Back to Top