Sunday, August 8, 2010

Re: Replace Admin Site Foreign Key Field/Dropdown with Textbox?

On Sun, Aug 8, 2010 at 4:00 PM, sixpackistan <robmagee@gmail.com> wrote:
> For foreign key fields in the Django Admin, the default display
> element is a drop down list box containing all of the foreign key
> items from the related model.  I have an asset tracking instance where
> this drop down box can contain hundreds of thousands of items and I am
> looking to not have the admin load them all.  Is there a way to
> override the admin interface and have it use a text box instead of the
> populated drop down?

Yup, documented right here:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields

Cheers,
Martin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment