Source

django-taggroups /

Filename Size Date modified Message
taggroup_example
taggroups
129 B
153 B
29 B
77 B
1.5 KB
165.5 KB
1.3 KB

add-on to django-tagging, to create: - models with multiple tag fields - tags organized into TagGroups - tags can be sorted into TagGroups in the django admin - models thus 'taggrouped' can be filtered using django-filters

there is an example project: taggroup_example run the django test server with the included sqlite database: python manage.py runserver

view: http://localhost:8000/ admin: http://localhost:8000/admin/ --- user: admin password: password

requirements: - modified django-filter to filter with tagfields in a form: http://github.com/tehfink/django-filter/ (only for example project) - django-tagging from svn: http://code.google.com/p/django-tagging/ - django 1.1 release

quickstart to integrate with your project:

  1. place requirements on your python path

  2. in your app's models.py:
    • for each model that requires taggroups, subclass TagGroupedModel
    • add a list named TAG_FIELDS (or something similar; i have separate lists for each model that needs them). the names in the list are the multiple TagSelectFields created on your model.
  3. run python manage.py syncdb

  4. log into django admin

  5. create some tags

  6. sort the tags into taggroups instances

  7. create an instance of your taggrouped model, and select tags from the TagGroups

  8. check it out: http://localhost:8000/tagtest/

  9. access an instance's TagGroup tags with get_tagfield(name) model method

  10. use the taggroup_for_object template tag to retrieve tags for an instance's TagGroup

this is very hacky, and i would love advice on making it better!