Django admin helper classes for django-taggit tags
Project description
django-taggit-helpers makes it easier to work with admin pages of models associated with django-taggit tags.
Source code is available on GitHub at mfcovington/django-taggit-helpers. Information about django-taggit is available on GitHub and Read the Docs.
Installation
PyPI
pip install django-taggit-helpers
GitHub
pip install https://github.com/mfcovington/django-taggit-helpers/releases/download/0.1.1/django-taggit-helpers-0.1.1.tar.gz
Configuration
Add taggit_helpers to INSTALLED_APPS in settings.py:
INSTALLED_APPS = (
...
'taggit',
'taggit_helpers',
)
Helper Classes
TaggitCounter
Display (and sort by) number of Taggit tags associated with tagged items.
from taggit_helpers import TaggitCounter
class MyModelAdmin(TaggitCounter, admin.ModelAdmin): # TaggitCounter before ModelAdmin
list_display = (
...
'taggit_counter',
)
Note: Currently, the TaggableManager() field must be named tags.
Note: To avoid overcounting, set distinct=True if further annotating the queryset with Count():
queryset.annotate(m2m_field_count=Count('m2m_field', distinct=True))
TaggitListFilter
Filter records by Taggit tags for the current model only. Tags are sorted alphabetically by name.
from taggit_helpers import TaggitListFilter
class MyModelAdmin(admin.ModelAdmin):
list_filter = [TaggitListFilter]
TaggitStackedInline
Add stacked inline for Taggit tags to admin. Tags are sorted alphabetically by name.
from taggit_helpers import TaggitStackedInline
class MyModelAdmin(admin.ModelAdmin):
inlines = [TaggitStackedInline]
TaggitTabularInline
Add tabular inline for Taggit tags to admin. Tags are sorted alphabetically by name.
from taggit_helpers import TaggitTabularInline
class MyModelAdmin(admin.ModelAdmin):
inlines = [TaggitTabularInline]
Issues
If you experience any problems or would like to request a feature, please create an issue on GitHub.
Version 0.1.1
Revision history
0.1.1 2015-06-11
Rename taggit_count to taggit_counter
0.1.0 2015-06-10
Django admin helper classes for django-taggit tags
TaggitCounter
TaggitListFilter
TaggitStackedInline
TaggitTabularInline
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-taggit-helpers-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ae6d8fb7fb315b98f1672f11046947ff07e3382e09028af5ca83d974aad1360 |
|
MD5 | 638add3a3aa559b82a3621c1f2d22dc3 |
|
BLAKE2b-256 | 1ea8121490f3f60353e8d163a73c3a524853c76e7ddb3e2a9759c90f1d6ea3be |
Hashes for django_taggit_helpers-0.1.1-py32-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdc052fa6ae5d13f060ca4ef91e7f79590565d0b3c4fbd42505dd0f533e65bac |
|
MD5 | 2cac896c2de9e29b66c2b5f144376f40 |
|
BLAKE2b-256 | 3afe8821e437d4797c0787c9b9cebbea90ef497004d3ac5989caeafc87ce8019 |