I have the following models:
class Student(models.Model):
class Meta:
app_label = 'ground'
name = models.CharField(max_length=255)
def __unicode__(self):
return unicode(self.name)
class Program(models.Model):
class Meta:
app_label = 'ground'
name = models.CharField(max_length=255)
student = models.ManyToManyField(Student)
def __unicode__(self):
return unicode(self.name)
And the following admin:
class ProgramAdmin(admin.ModelAdmin):
formfield_overrides = {
models.ManyToManyField: {
'widget': admin.widgets.FilteredSelectMultiple(
Student._meta.verbose_name_plural, False)
}
}
admin.site.register(Program, ProgramAdmin)
As you can see I use django's FilteredSelectMultiple to display a nice select field for the Program admin where I can select multiple students at once.
Problem I have over 2500 students in the database. The browser has problems with rendering all students into the select field. Is there a way to overcome this problem. Like doing stuff with javascript