django admin helper classes for django-sitecats categories
Project description
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
Setup
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.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.admin import CategoryListFilter
class MyModelAdmin(admin.ModelAdmin):
list_filter = [CategoryListFilter]
CategoryStackedInline
Add stacked inline for categories to admin.
from sitecats_helpers.admin import CategoryStackedInline
class MyModelAdmin(admin.ModelAdmin):
inlines = [CategoryStackedInline]
CategoryTabularInline
Add tabular inline for categorise to admin.
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. :-)
License
django-sitecats-helpers is released under the MIT license.
Changes
1.0.0 (2021-11-29)
Added Django 3+ support.
Dropped Python 2.7 support.
Dropped Django 1.10 / 1.11 support.
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-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc9c7cadf86da03fc321ec7183affcd71c7b10146cc8a00672c7fa96055e8e8b |
|
MD5 | 4ddb5b6116518cb80b3d05d5ec1acc11 |
|
BLAKE2b-256 | d9587daed7caa6afc01aadf8fb1a7383d8e05fe2b3848438e7be4634f4d86bee |
Hashes for django_sitecats_helpers-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f66506471cc96a297c65329e7c1530b5095874799db718e6448c6d8a4a38890 |
|
MD5 | b3aa1faa83afd812464e1d6c06151a45 |
|
BLAKE2b-256 | 6f9cd49f92cad5125e7a2d292a4753a5e4f2f1c61d7c1c5ebac197c414b4288c |