django admin helper classes for django-sitecats categories
Project description
django-sitecats-helpers
Django admin helper classes for django-sitecats categories.
Authored by Basil Shubin, inspired by django-taggit-helpers
Installation
First install the module, preferably in a virtual environment. It can be installed from PyPI:
pip install django-sitecats-helpers
Configuration
First make sure the project is configured for django-sitecats.
Then add the following settings:
INSTALLED_APPS += (
'sitecats_helpers',
)
Usage
CategoryCounter
Display (and sort by) number of categories associated with objects.
from sitecats_helpers import CategoryCounter
# For Django 1.9+, use this instead:
# from sitecats_helpers.admin import CategoryCounter
class MyModelAdmin(CategoryCounter, admin.ModelAdmin): # CategoryCounter before ModelAdmin
list_display = (
...
'category_counter',
)
CategoryListFilter
Filter records by categories for the current model only.
from sitecats_helpers import CategoryListFilter
# For Django 1.9+, use this instead:
# from sitecats_helpers.admin import CategoryListFilter
class MyModelAdmin(admin.ModelAdmin):
list_filter = [CategoryListFilter]
CategoryStackedInline
Add stacked inline for categories to admin.
from sitecats_helpers import CategoryStackedInline
# For Django 1.9+, use this instead:
# from sitecats_helpers.admin import CategoryStackedInline
class MyModelAdmin(admin.ModelAdmin):
inlines = [CategoryStackedInline]
CategoryTabularInline
Add tabular inline for categorise to admin.
from sitecats_helpers import CategoryTabularInline
# For Django 1.9+, use this instead:
# from sitecats_helpers.admin import CategoryTabularInline
class MyModelAdmin(admin.ModelAdmin):
inlines = [CategoryTabularInline]
Contributing
If you like this module, forked it, or would like to improve it, please let us know! Pull requests are welcome too. :-)
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-sitecats-helpers-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99a1fc45b22c38034da83def62fd93360464449dceb8fcc8a93d665e2c66218b |
|
MD5 | fbec7879f1f1e4f5a1f90d009cf4d86f |
|
BLAKE2b-256 | cc5a94a2d90f054083cc15e7da70623ed06cda3ed1a2bd83c86754a37bd968b0 |
Hashes for django_sitecats_helpers-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e52c33511bd34f30f24cd803d5b40433230b2891f947ca889a0d07d9484c7ee5 |
|
MD5 | f5d37ea4fc66776901c502b1197544cb |
|
BLAKE2b-256 | 43fc007523f112624a2b0c3df8ae4a65accf75c1da48dd85052e20654296c5cd |