You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Install app, install before django.contrib.admin
35
-
INSTALLED_APPS= [
36
-
'fontawesomefree',
37
-
'admin_extended',
38
-
'django.contrib.admin',
39
-
...
40
-
]
41
-
42
-
ADMIN_EXTENDED= {
43
-
'MENU_APP_ORDER': ['user', 'auth'],
44
-
'MENU_MODEL_ORDER': ['User', 'Group'],
45
-
'APP_ICON': {
46
-
'user': 'fas fa-user',
47
-
'auth': 'fas fa-users',
48
-
},
49
-
'MODEL_ADMIN_TABBED_INLINE': True,
50
-
'RAW_ID_FIELDS_AS_DEFAULT': False,
51
-
}
52
-
53
-
- MENU_APP_ORDER: change order of app at left sidebar
54
-
- MENU_MODEL_ORDER: change order of model at left sidebar
55
-
- APP_ICON: custom icon of menu app use fontawesome v5 (https://fontawesome.com/v5.15/icons?d=gallery&p=2&m=free)
56
-
- MODEL_ADMIN_TABBED_INLINE: use tab for model inline. Default is True
57
-
- RAW_ID_FIELDS_AS_DEFAULT: use raw_id_fields (or autocomplete_fields if related model have search_fields) as default for related fields instead of select box
58
-
59
-
60
-
61
-
Basic Usage
62
-
===========
63
-
64
-
.. code:: python
65
-
66
-
from django.apps import apps
67
-
from django.contrib import admin
68
-
from admin_extended.base import ExtendedAdminModel
69
-
from . import models
70
-
71
-
72
-
73
-
classPostCommentInline(admin.TabularInline):
74
-
model = models.PostComment
75
-
extra =0
76
-
77
-
classPostTagInline(admin.TabularInline):
78
-
model = models.PostTag
79
-
extra =0
80
-
81
-
@admin.register(models.Post)
82
-
classPostAdmin(ExtendedAdminModel):
83
-
list_display = ('id', 'title', 'post_at')
84
-
search_fields = ('title',)
85
-
search_help_text ='Search by title'
86
-
list_filter = ('status',)
87
-
inlines = [
88
-
PostCommentInline,
89
-
PostTagInline
90
-
]
91
-
92
-
**ExtendedAdminModel options**
93
-
94
-
- **raw_id_fields_as_default** (boolean, default True) Use raw_id_fields (or autocomplete_fields if related model have search_fields) as default for ForeginKey instead of select box (optimize performance for large database)
- **tab_inline** (boolean, default from setting) Use tab for model inline (override value in setting)
97
-
- **super_admin_only_fields** (list, default []) Only show these fields if user login is superuser
98
-
- **ext_read_only_fields** (list, default []) Only show these fields in view mode. Default custom fields start with `display_` was mark as read only so you don't need add these fields to ext_read_only_fields
99
-
- **ext_write_only_fields** (list, default []) Only show these fields in edit mode
100
-
- **enable_foreign_link** (boolean, default True) Add link for foregin key in change list page
101
-
102
-
103
-
Advand
104
-
======
105
-
Add custom object tools item in change list or change form
This function will automatic register admin for all unregistered model
189
-
190
-
- default_model_admin_class: DefaultModelAdmin will list all fields (exclude TextField) of model in change list page, you can custom your model admin and pass to this param
191
-
- ignore_models: list model you don't want auto register. specify by <app_label>.<model_name>. Eg: 'users.user'
0 commit comments