views:

124

answers:

1

I've added filter horizontal

filter_horizontal = ('blocked_email_notifications',)

To my ModelAdmin, but it's still rendering it as a multiple select widget, rather than the nifty javascript enhanced version. How come? Do I need to add something else?

The user model has it defined as

blocked_email_notifications = ManyToManyField('EmailTemplate', blank=True)

And the form has it defined as

blocked_email_notifications = ModelMultipleChoiceField(queryset=EmailTemplate.objects.order_by('key'), required=False)
+3  A: 

If you define the field in the form you need to include the widget:

from django.contrib.admin.widgets import FilteredSelectMultiple

blocked_email_notifications = ModelMultipleChoiceField(
    queryset=EmailTemplate.objects.order_by('key'), 
    required=False, widget=FilteredSelectMultiple)
lazerscience
Ah...knew I was missing something.
Mark