Skip to content

Instantly share code, notes, and snippets.

View arminbw's full-sized avatar

Armin arminbw

View GitHub Profile
@tdsymonds
tdsymonds / mptt_m2m_admin.py
Created October 7, 2016 15:13
Improves the filter_horizontal widget for many to many admin relationship to model using django-mptt and django-parler.
# models.py
from mptt.models import MPTTModel, TreeForeignKey
from parler.models import TranslatableModel, TranslatedFields
from .managers import CategoryManager
class Category(MPTTModel, TranslatableModel):
parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True)