Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Django's filter_horizontal/filter_vertical functionality in FeinCMS widgets
"""
Django's filter_horizontal/filter_vertical functionality in FeinCMS widgets
"""
from django.db import models
from feincms.admin.item_editor import FeinCMSInline
class PartyWidgetInlines(FeinCMSInline):
filter_horizontal = ['drinks', 'snacks']
class Drink(model.Model):
pass
class Snack(models.Model):
pass
class PartyWidget(models.Model):
drinks = models.ManyToManyField(Drink, verbose_name=_('Drinks'))
snacks = models.ManyToManyField(Snack, verbose_name=_('Snacks'))
# Additional config for FeinCMS
feincms_item_editor_inline = PartyWidgetInlines
def __unicode__(self):
return u'Party widget'
class Meta:
abstract = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment