Ticket #11465: patch.diff

File patch.diff, 654 bytes (added by sacre, 15 years ago)
  • contrib/admin/widgets.py

     
    147147           
    148148    def label_for_value(self, value):
    149149        key = self.rel.get_related_field().name
    150         obj = self.rel.to._default_manager.get(**{key: value})
     150        try:
     151            obj = self.rel.to._default_manager.get(**{key: value})
     152        except self.rel.to.DoesNotExist:
     153            return ''
    151154        return '&nbsp;<strong>%s</strong>' % truncate_words(obj, 14)
    152155
    153156class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
Back to Top