Integrating with Django Categories¶
Install django-categories¶
Install
django-categories$ pip install django-categoriesAdd
categoriesto yourINSTALLED_APPSsetting.INSTALLED_APPS = ( ... 'categories', ... )
Supply the fields you want to be added to the
Storymodel.CATEGORIES_SETTINGS = { ... 'FK_REGISTRY': { 'stories.story': { 'name': 'primary_category', 'related_name': 'primary_category' } }, 'M2M_REGISTRY': { 'stories.story': { 'name': 'categories', 'related_name': 'categories' } } ... }
In this case, 2 fields are setup, one
ForeignKeyfield called primary_category and oneManyToManyfield called categoriesSync your database
$ ./manage.py syncdbor if your using
South$ ./manage.py syncdb --migrate