Replace Admin Site Foreign Key Field/Dropdown with Textbox?

4,568 vistas
Ir al primer mensaje no leído

sixpackistan

no leída,
8 ago 2010, 10:00:29 a.m.8/8/10
para Django users
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?

Martin Melin

no leída,
8 ago 2010, 10:10:08 a.m.8/8/10
para django...@googlegroups.com

vikalp sahni

no leída,
8 ago 2010, 2:54:20 p.m.8/8/10
para django...@googlegroups.com
You can also hide that field which inturn will not load it on page by using

"fields" attribute in admin class for that particular model and specify all the fields
required to be shown on change list page. Just omit the Foreign Key field in the "fields"
list in case u don't need it in admin.

Carpe Diem,
//Vikalp


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


Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos