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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fd2757393b6da44cf4b584e458f3d83557a695faf44bcdd6060e85db447d4a2 |
|
MD5 | 8460992b6cdbce514d7e53bbf2da8fc7 |
|
BLAKE2b-256 | 35969fc532ec7e406dd4ea4f9937ffefe539ee4601bba93ed8fee6fee6953304 |
Hashes for django_sitecats_helpers-0.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93f5dea15b0073c29ca42cfd6cc3a03a6dcc4698ef5bf0c145798ec1ddace07c |
|
MD5 | 2b6a2fd3ee8783ab42bbffff3ef993e8 |
|
BLAKE2b-256 | 9aed3834118525cca9553dd42ac42e2e9964e8d477339551ba2349129d83f090 |