Reputation: 17812
I have a ModelChoiceField
in django forms:
customField = forms.ModelChoiceField(queryset=MyModel.objects.filter(type="sometype"))
But this queryset returns thousands of rows, effectively choking customField in the admin interface. Instead, I need an autosuggest text field there, which will perform a like '%keystrokes%'
query on above queryset. I feel this is a better option. I need a very basic auto-suggest, no fancy css. Is there any implicit support for this in django? I went through django autosuggest plugins, but they were very complex.
Can I tie it with django's core field types, like: models.ForeignKey('MyModel')
, similarly, models.AutosuggestField('MyModel')
Upvotes: 1
Views: 715
Reputation: 4920
see this
for admin you can have auto complete
Upvotes: 2