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
File details
Details for the file django-sitecats-helpers-0.0.4.tar.gz
.
File metadata
- Download URL: django-sitecats-helpers-0.0.4.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be4bbf4e6833e876cb7089217386b2a17c64ed4572b18e275e5602f0b6725d7c |
|
MD5 | e6841d319470d616ec596c1552304712 |
|
BLAKE2b-256 | 4ce2d137a5a985adbe51efc77b89122a40d12adcb7094909cd53f2ff9844d746 |
File details
Details for the file django_sitecats_helpers-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: django_sitecats_helpers-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e08dbd2845c1c4b9ac1076808e015308300df48fa1e3d40de9488efecbe9481 |
|
MD5 | 477769a408415e370317261ce2ec2ac4 |
|
BLAKE2b-256 | 59c95981892341ad3f1cb13a4731eda807dcdd0ea55a9a6872f47714f1fd5925 |