My favorites | Sign in
Project Home Downloads Issues Source
Search
for
relatedlookups_2_2  
Updated Oct 13, 2010 by sehmaschine

Related Lookups

When entering a value (ID) for a ForeignKey, the related object is instantly displayed right beside the input-field (after the search-icon).

This also works for a M2M-field.

Usage

model.py

class MyModel(models.Model):
    related = models.ForeignKey(RelatedModel, verbose_name=u"Related Lookup", null=True, blank=True)
    # ...

admin.py

class MyModelAdmin(admin.ModelAdmin):
    list_display  = ('__unicode__',)
    raw_id_fields = ('related',)    
    # ...
Powered by Google Project Hosting