mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Added customization of admin fieldsets
This commit is contained in:
parent
4698f32fc0
commit
0f2f24d2ce
4 changed files with 24 additions and 9 deletions
|
|
@ -1,8 +1,8 @@
|
|||
__version_info__ = {
|
||||
'major': 1,
|
||||
'minor': 1,
|
||||
'micro': 4,
|
||||
'releaselevel': 'final',
|
||||
'minor': 2,
|
||||
'micro': 0,
|
||||
'releaselevel': 'beta',
|
||||
'serial': 1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ Contents
|
|||
usage
|
||||
registering_models
|
||||
adding_the_fields
|
||||
admin_settings
|
||||
custom_categories
|
||||
reference/index
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ The ``CATEGORIES_SETTINGS`` dictionary is where you can override the default set
|
|||
The default settings are:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
CATEGORIES_SETTINGS = {
|
||||
'ALLOW_SLUG_CHANGE': False,
|
||||
'CACHE_VIEW_LENGTH': 0,
|
||||
|
|
@ -23,6 +23,7 @@ The default settings are:
|
|||
'THUMBNAIL_UPLOAD_PATH': 'uploads/categories/thumbnails',
|
||||
'THUMBNAIL_STORAGE': settings.DEFAULT_FILE_STORAGE,
|
||||
'SLUG_TRANSLITERATOR': lambda x: x,
|
||||
'ADMIN_FIELDSETS': {}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -119,3 +120,12 @@ JAVASCRIPT_URL
|
|||
**Default:** ``STATIC_URL or MEDIA_URL + 'js/'``
|
||||
|
||||
**Description:** Allows for customization of javascript placement.
|
||||
|
||||
.. _ADMIN_FIELDSETS:
|
||||
|
||||
ADMIN_FIELDSETS
|
||||
===============
|
||||
|
||||
**Default:** ``{}``
|
||||
|
||||
**Description:** Allows for selective customization of the default behavior of adding the fields to the admin class. See :ref:`admin_settings` for more information.
|
||||
|
|
@ -3,9 +3,13 @@ from django.contrib import admin
|
|||
|
||||
from categories.admin import CategoryBaseAdmin, CategoryBaseAdminForm
|
||||
|
||||
# class SimpleTextAdmin(admin.ModelAdmin):
|
||||
# filter_horizontal = ['cats',]
|
||||
#
|
||||
class SimpleTextAdmin(admin.ModelAdmin):
|
||||
fieldsets = (
|
||||
(None, {
|
||||
'fields': ('name', 'description', )
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
class SimpleCategoryAdminForm(CategoryBaseAdminForm):
|
||||
class Meta:
|
||||
|
|
@ -13,6 +17,6 @@ class SimpleCategoryAdminForm(CategoryBaseAdminForm):
|
|||
|
||||
class SimpleCategoryAdmin(CategoryBaseAdmin):
|
||||
form = SimpleCategoryAdminForm
|
||||
|
||||
admin.site.register(SimpleText) #, SimpleTextAdmin)
|
||||
|
||||
admin.site.register(SimpleText, SimpleTextAdmin)
|
||||
admin.site.register(SimpleCategory, SimpleCategoryAdmin)
|
||||
Loading…
Reference in a new issue