https://github.com/bashu/django-sitecats-helpers
😹 django admin helper classes for django-sitecats categories
https://github.com/bashu/django-sitecats-helpers
django django-sitecats
Last synced: about 1 month ago
JSON representation
😹 django admin helper classes for django-sitecats categories
- Host: GitHub
- URL: https://github.com/bashu/django-sitecats-helpers
- Owner: bashu
- License: mit
- Created: 2016-05-21T06:31:25.000Z (about 10 years ago)
- Default Branch: develop
- Last Pushed: 2021-11-30T03:21:57.000Z (over 4 years ago)
- Last Synced: 2025-03-11T12:40:17.916Z (about 1 year ago)
- Topics: django, django-sitecats
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE
Awesome Lists containing this project
README
django-sitecats-helpers
=======================
.. image:: https://img.shields.io/pypi/v/django-sitecats-helpers.svg
:target: https://pypi.python.org/pypi/django-sitecats-helpers/
.. image:: https://img.shields.io/pypi/dm/django-sitecats-helpers.svg
:target: https://pypi.python.org/pypi/django-sitecats-helpers/
.. image:: https://img.shields.io/github/license/bashu/django-sitecats-helpers.svg
:target: https://pypi.python.org/pypi/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:
.. code-block:: shell
pip install django-sitecats-helpers
Setup
-----
First make sure the project is configured for django-sitecats_.
Then add the following settings:
.. code-block:: python
INSTALLED_APPS += (
'sitecats_helpers',
)
Usage
-----
CategoryCounter
~~~~~~~~~~~~~~~
Display (and sort by) number of categories associated with objects.
.. code-block:: python
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.
.. code-block:: python
from sitecats_helpers.admin import CategoryListFilter
class MyModelAdmin(admin.ModelAdmin):
list_filter = [CategoryListFilter]
CategoryStackedInline
~~~~~~~~~~~~~~~~~~~~~
Add stacked inline for categories to admin.
.. code-block:: python
from sitecats_helpers.admin import CategoryStackedInline
class MyModelAdmin(admin.ModelAdmin):
inlines = [CategoryStackedInline]
CategoryTabularInline
~~~~~~~~~~~~~~~~~~~~~
Add tabular inline for categorise to admin.
.. code-block:: python
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.
.. _django-sitecats: https://github.com/idlesign/django-sitecats
.. _django-taggit-helpers: https://github.com/mfcovington/django-taggit-helpers