elsadek
elsadek

Reputation: 1086

Django admin, override dropdown with selection from popup window

In a one-to-many relationship, how can I override the drop-down menu in the change-form to be able to select value from popup window, specially when dropdown could hold a pretty long list which may slowdown the page load.

Upvotes: 1

Views: 1175

Answers (1)

elsadek
elsadek

Reputation: 1086

Just found the answer:

raw_id_fields is a list of fields you would like to change into an Input widget for either a ForeignKey or ManyToManyField:

class ArticleAdmin(admin.ModelAdmin): raw_id_fields = ("newspaper",)

https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields

The question now is how can I display a user friendly value instead of the Id returned from the popup.

Upvotes: 1

Related Questions