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!

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.