Skip to main content

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.

django-taggit-helpers is compatible with Python 2.7+/3.2+ and Django 1.7+.

Installation

PyPI

pip install django-taggit-helpers

GitHub (development branch)

pip install git+http://github.com/mfcovington/django-taggit-helpers.git@develop

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
# For Django 1.9+, use this instead:
# from taggit_helpers.admin 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
# For Django 1.9+, use this instead:
# from taggit_helpers.admin 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
# For Django 1.9+, use this instead:
# from taggit_helpers.admin 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
# For Django 1.9+, use this instead:
# from taggit_helpers.admin import TaggitTabularInline

class MyModelAdmin(admin.ModelAdmin):
    inlines = [TaggitTabularInline]

Upgrading existing projects to Django 1.9+

App loading was refactored in Django 1.9. To make a Django 1.7/1.8 app Django 1.9-compatible with respect to django-taggit-helpers, run the following shell command in your app’s directory.

find . -name '*.py' | xargs perl -i -pe 's/from taggit_helpers import/from taggit_helpers.admin import/'

Thanks to jpic for the inspiration for this snippet!

Issues

If you experience any problems or would like to request a feature, please create an issue on GitHub.

Version 0.1.4

Revision history

0.1.4 2015-12-04

  • Add Django 1.9 compatibility

0.1.3 2015-11-30

  • Require Python 2.7+/3.2+

  • Add slides from Django SF Meetup lightning talk

0.1.2 2015-06-14

  • Add Django 1.8 compatibility

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

Release files for django-taggit-helpers 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-taggit-helpers 0.1.4
File Size Uploaded
django-taggit-helpers-0.1.4.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-taggit-helpers 0.1.4
File Interpreter ABI Platform
django_taggit_helpers-0.1.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 12.0 kB

Release files / django-taggit-helpers-0.1.4.tar.gz

Download URL django-taggit-helpers-0.1.4.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d988c06f0220b47c6f2eaef1216471305356adb6c34cfc920acc2296686e6db5
BLAKE2b-256 checksum
How to use checksums
6b7ab0bb9007b3ca0447498d01b6d298a53daac5042a656aa5c6645961a2c65c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_taggit_helpers-0.1.4-py2.py3-none-any.whl

Download URL django_taggit_helpers-0.1.4-py2.py3-none-any.whl
Size 6.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
240a0c2281807d9c356d50cbaf176bcaffdb3a039acc72af18223e78ab1703e4
BLAKE2b-256 checksum
How to use checksums
8975c9814bd50dca05cb7b4ef0abc47d2a4d3993a2863e45b112d09b509708bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page