Ticket #4641: r6898_fk_raw_id_fix.diff

File r6898_fk_raw_id_fix.diff, 893 bytes (added by Brian Rosner, 17 years ago)

same patch karen provided, plus removing the TODO that this fixes. not trying to be picky ;)

  • django/contrib/admin/widgets.py

    diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
    index 26aacf7..51d7d8d 100644
    a b class ForeignKeyRawIdWidget(forms.TextInput):  
    100100        output.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % \
    101101            (related_url, url, name))
    102102        output.append('<img src="%simg/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>' % settings.ADMIN_MEDIA_PREFIX)
     103        if value:
     104            output.append('&nbsp;<strong>%s</strong>' % self.rel.to.objects.get(pk=value))
    103105        return mark_safe(u''.join(output))
    104         #if self.change: # TODO
    105             #output.append('&nbsp;<strong>TODO</strong>')
    106106           
    107107class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
    108108    """
Back to Top