django-tabbed-admin3 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django-tabbed-admin3-3.0.0/AUTHORS.txt +3 -0
- django-tabbed-admin3-3.0.0/LICENSE.txt +27 -0
- django-tabbed-admin3-3.0.0/MANIFEST.in +5 -0
- django-tabbed-admin3-3.0.0/PKG-INFO +210 -0
- django-tabbed-admin3-3.0.0/README.rst +190 -0
- django-tabbed-admin3-3.0.0/django_tabbed_admin3.egg-info/PKG-INFO +210 -0
- django-tabbed-admin3-3.0.0/django_tabbed_admin3.egg-info/SOURCES.txt +47 -0
- django-tabbed-admin3-3.0.0/django_tabbed_admin3.egg-info/dependency_links.txt +1 -0
- django-tabbed-admin3-3.0.0/django_tabbed_admin3.egg-info/top_level.txt +1 -0
- django-tabbed-admin3-3.0.0/setup.cfg +7 -0
- django-tabbed-admin3-3.0.0/setup.py +38 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/__init__.py +6 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/admin.py +150 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/models.py +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/settings.py +18 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_0_eeeeee_40x100.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_55_c0402a_40x100.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_55_eeeeee_40x100.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_glass_100_f8f8f8_1x400.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_glass_35_dddddd_1x400.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_glass_60_eeeeee_1x400.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_inset-hard_75_999999_1x100.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-bg_inset-soft_50_c9c9c9_1x100.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_3383bb_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_444444_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_454545_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_555555_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_70b2e1_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_777620_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_777777_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_999999_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_cc0000_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_fbc856_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/images/ui-icons_ffffff_256x240.png +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/jquery-ui-1.11.4.min.css +7 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/tabbed_admin.css +1 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/css/tabbed_grappelli_admin.css +1 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/static/tabbed_admin/js/jquery-ui-1.11.4.min.js +8 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/templates/tabbed_admin/change_form.html +104 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/templatetags/__init__.py +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/templatetags/tabbed_admin_tags.py +49 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/tests/__init__.py +0 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/tests/admin.py +42 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/tests/models.py +55 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/tests/runtests.py +74 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/tests/tests.py +240 -0
- django-tabbed-admin3-3.0.0/tabbed_admin/tests/urls.py +6 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2015, Guillaume Pousseo
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of the <ORGANIZATION> nor the names of its contributors
|
|
15
|
+
may be used to endorse or promote products derived from this software
|
|
16
|
+
without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django-tabbed-admin3
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Easily add tabs to django admin forms.
|
|
5
|
+
Author: Michael Galler
|
|
6
|
+
Author-email: mgaller@live.de
|
|
7
|
+
License: BSD License
|
|
8
|
+
Platform: OS Independent
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
18
|
+
License-File: LICENSE.txt
|
|
19
|
+
License-File: AUTHORS.txt
|
|
20
|
+
|
|
21
|
+
###################
|
|
22
|
+
Django tabbed admin
|
|
23
|
+
###################
|
|
24
|
+
|
|
25
|
+
This is a simple fork of django-tabbed-admin https://github.com/omji/django-tabbed-admin with Django 4.x fix.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Simple library to easilly add tabs to admin forms. It also allows users to re-order inlines and fieldsets.
|
|
29
|
+
Django tabbed admin is compatible with django-grappelli and django-gipsy.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
*******
|
|
33
|
+
Install
|
|
34
|
+
*******
|
|
35
|
+
|
|
36
|
+
It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv.
|
|
37
|
+
|
|
38
|
+
From PyPi
|
|
39
|
+
|
|
40
|
+
.. code-block:: shell-session
|
|
41
|
+
|
|
42
|
+
pip install django-tabbed-admin3
|
|
43
|
+
|
|
44
|
+
From Github
|
|
45
|
+
|
|
46
|
+
.. code-block:: shell-session
|
|
47
|
+
|
|
48
|
+
https://github.com/mgaller/django-tabbed-admin3#egg=tabbed_admin
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
*****
|
|
52
|
+
setup
|
|
53
|
+
*****
|
|
54
|
+
|
|
55
|
+
Simply add the app in your installed apps list in settings.py
|
|
56
|
+
|
|
57
|
+
.. code-block:: python
|
|
58
|
+
|
|
59
|
+
INSTALLED_APPS = (
|
|
60
|
+
...
|
|
61
|
+
'tabbed_admin'
|
|
62
|
+
...
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
Django-tabbed-admin by default requires Jquery UI tabs plugin in order to work. It is packaged with the static files required to make it funcitonnal, however, they are not activated by default to avoid a conflict with other libraries.
|
|
66
|
+
|
|
67
|
+
In order to activate the Jquery UI statics, add the following line to the project settings:
|
|
68
|
+
|
|
69
|
+
.. code-block:: python
|
|
70
|
+
|
|
71
|
+
TABBED_ADMIN_USE_JQUERY_UI = True
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
********************
|
|
75
|
+
Configure admin tabs
|
|
76
|
+
********************
|
|
77
|
+
|
|
78
|
+
In order to add tabs to a model admin, it should inherit from tabbed_admin.TabbedModelAdmin and contain a tabs attribute.
|
|
79
|
+
The tab attribute configuration tries to remain similar to the fieldsets and inlines setup logic.
|
|
80
|
+
|
|
81
|
+
Basically, a tuple can be created for each tab exactely the same way as for fieldsets, except that inlines can be added anywhere in between.
|
|
82
|
+
|
|
83
|
+
.. code-block:: python
|
|
84
|
+
|
|
85
|
+
tab_overview = (
|
|
86
|
+
(None, {
|
|
87
|
+
'fields': ('name', 'bio', 'style')
|
|
88
|
+
}),
|
|
89
|
+
MusicianInline,
|
|
90
|
+
('Contact', {
|
|
91
|
+
'fields': ('agent', 'phone', 'email')
|
|
92
|
+
})
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
Then each tuple have to be passed to a *tabs* attribute prefixed by the verbose name to display within the tab:
|
|
96
|
+
|
|
97
|
+
.. code-block:: python
|
|
98
|
+
|
|
99
|
+
tabs = [
|
|
100
|
+
('Overview', tab_overview),
|
|
101
|
+
('Albums', tab_album)
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
A full example would give:
|
|
106
|
+
|
|
107
|
+
.. code-block:: python
|
|
108
|
+
|
|
109
|
+
from django.contrib import admin
|
|
110
|
+
|
|
111
|
+
from tabbed_admin import TabbedModelAdmin
|
|
112
|
+
from .models import Band, Musician, Album
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class MusicianInline(admin.StackedInline):
|
|
116
|
+
model = Musician
|
|
117
|
+
extra = 1
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class AlbumInline(admin.TabularInline):
|
|
121
|
+
model = Album
|
|
122
|
+
extra = 1
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@admin.register(Band)
|
|
126
|
+
class BandAdmin(TabbedModelAdmin):
|
|
127
|
+
model = Band
|
|
128
|
+
|
|
129
|
+
tab_overview = (
|
|
130
|
+
(None, {
|
|
131
|
+
'fields': ('name', 'bio', 'style')
|
|
132
|
+
}),
|
|
133
|
+
MusicianInline,
|
|
134
|
+
('Contact', {
|
|
135
|
+
'fields': ('agent', 'phone', 'email')
|
|
136
|
+
})
|
|
137
|
+
)
|
|
138
|
+
tab_album = (
|
|
139
|
+
AlbumInline,
|
|
140
|
+
)
|
|
141
|
+
tabs = [
|
|
142
|
+
('Overview', tab_overview),
|
|
143
|
+
('Albums', tab_album)
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
**************************
|
|
147
|
+
Configure tabs dynamically
|
|
148
|
+
**************************
|
|
149
|
+
|
|
150
|
+
Be warned that the tabs will completely reset the fieldsets and inlines attributes in order to avoid conflicts during the form saving. Both attributes are overwritten with the entries passed to the tabs attribute. For the same reasons, it is highly recommanded not to overwrite get_fieldsets or get_inlines.
|
|
151
|
+
|
|
152
|
+
You can pass and modify the tabs dynamically the same way you would do for fieldsets or inlines.
|
|
153
|
+
|
|
154
|
+
.. code-block:: python
|
|
155
|
+
|
|
156
|
+
def get_tabs(self, request, obj=None):
|
|
157
|
+
tabs = self.tabs
|
|
158
|
+
if obj is not None:
|
|
159
|
+
tab_overview = self.tab_overview + ('Social', {
|
|
160
|
+
'fields': ('website', 'twitter', 'facebook')
|
|
161
|
+
})
|
|
162
|
+
tab_ressources = self.tab_ressources + (InterviewInline, )
|
|
163
|
+
tabs = [
|
|
164
|
+
('Overview', tab_overview),
|
|
165
|
+
('Ressources', tab_ressources)
|
|
166
|
+
]
|
|
167
|
+
self.tabs = tabs
|
|
168
|
+
return super(BandAdmin, self).get_tabs(request, obj)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
********************
|
|
172
|
+
Change the jquery ui
|
|
173
|
+
********************
|
|
174
|
+
|
|
175
|
+
You can change the jquery ui css and js by either overriding the media in the
|
|
176
|
+
admin class
|
|
177
|
+
|
|
178
|
+
.. code-block:: python
|
|
179
|
+
|
|
180
|
+
class Media:
|
|
181
|
+
css = {
|
|
182
|
+
'all': ('css/jquery-ui.theme.min.css',)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
or by changing the the following settings,
|
|
186
|
+
|
|
187
|
+
`TABBED_ADMIN_JQUERY_UI_CSS` and `TABBED_ADMIN_JQUERY_UI_JS`
|
|
188
|
+
|
|
189
|
+
.. code-block:: python
|
|
190
|
+
|
|
191
|
+
TABBED_ADMIN_JQUERY_UI_CSS = 'static/css/my-custom-jquery-ui.css'
|
|
192
|
+
TABBED_ADMIN_JQUERY_UI_JS = 'static/js/my-custom-jquery-ui.js'
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
Contribution
|
|
196
|
+
************
|
|
197
|
+
|
|
198
|
+
Please feel free to contribute. Any help and advices are much appreciated.
|
|
199
|
+
You will find an example application to run and develop the library easily.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
*****
|
|
203
|
+
LINKS
|
|
204
|
+
*****
|
|
205
|
+
|
|
206
|
+
Development:
|
|
207
|
+
https://github.com/mgaller/django-tabbed-admin3
|
|
208
|
+
|
|
209
|
+
Package:
|
|
210
|
+
https://pypi.python.org/pypi/django-tabbed-admin3
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
###################
|
|
2
|
+
Django tabbed admin
|
|
3
|
+
###################
|
|
4
|
+
|
|
5
|
+
This is a simple fork of django-tabbed-admin https://github.com/omji/django-tabbed-admin with Django 4.x fix.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Simple library to easilly add tabs to admin forms. It also allows users to re-order inlines and fieldsets.
|
|
9
|
+
Django tabbed admin is compatible with django-grappelli and django-gipsy.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
*******
|
|
13
|
+
Install
|
|
14
|
+
*******
|
|
15
|
+
|
|
16
|
+
It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv.
|
|
17
|
+
|
|
18
|
+
From PyPi
|
|
19
|
+
|
|
20
|
+
.. code-block:: shell-session
|
|
21
|
+
|
|
22
|
+
pip install django-tabbed-admin3
|
|
23
|
+
|
|
24
|
+
From Github
|
|
25
|
+
|
|
26
|
+
.. code-block:: shell-session
|
|
27
|
+
|
|
28
|
+
https://github.com/mgaller/django-tabbed-admin3#egg=tabbed_admin
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
*****
|
|
32
|
+
setup
|
|
33
|
+
*****
|
|
34
|
+
|
|
35
|
+
Simply add the app in your installed apps list in settings.py
|
|
36
|
+
|
|
37
|
+
.. code-block:: python
|
|
38
|
+
|
|
39
|
+
INSTALLED_APPS = (
|
|
40
|
+
...
|
|
41
|
+
'tabbed_admin'
|
|
42
|
+
...
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
Django-tabbed-admin by default requires Jquery UI tabs plugin in order to work. It is packaged with the static files required to make it funcitonnal, however, they are not activated by default to avoid a conflict with other libraries.
|
|
46
|
+
|
|
47
|
+
In order to activate the Jquery UI statics, add the following line to the project settings:
|
|
48
|
+
|
|
49
|
+
.. code-block:: python
|
|
50
|
+
|
|
51
|
+
TABBED_ADMIN_USE_JQUERY_UI = True
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
********************
|
|
55
|
+
Configure admin tabs
|
|
56
|
+
********************
|
|
57
|
+
|
|
58
|
+
In order to add tabs to a model admin, it should inherit from tabbed_admin.TabbedModelAdmin and contain a tabs attribute.
|
|
59
|
+
The tab attribute configuration tries to remain similar to the fieldsets and inlines setup logic.
|
|
60
|
+
|
|
61
|
+
Basically, a tuple can be created for each tab exactely the same way as for fieldsets, except that inlines can be added anywhere in between.
|
|
62
|
+
|
|
63
|
+
.. code-block:: python
|
|
64
|
+
|
|
65
|
+
tab_overview = (
|
|
66
|
+
(None, {
|
|
67
|
+
'fields': ('name', 'bio', 'style')
|
|
68
|
+
}),
|
|
69
|
+
MusicianInline,
|
|
70
|
+
('Contact', {
|
|
71
|
+
'fields': ('agent', 'phone', 'email')
|
|
72
|
+
})
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
Then each tuple have to be passed to a *tabs* attribute prefixed by the verbose name to display within the tab:
|
|
76
|
+
|
|
77
|
+
.. code-block:: python
|
|
78
|
+
|
|
79
|
+
tabs = [
|
|
80
|
+
('Overview', tab_overview),
|
|
81
|
+
('Albums', tab_album)
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
A full example would give:
|
|
86
|
+
|
|
87
|
+
.. code-block:: python
|
|
88
|
+
|
|
89
|
+
from django.contrib import admin
|
|
90
|
+
|
|
91
|
+
from tabbed_admin import TabbedModelAdmin
|
|
92
|
+
from .models import Band, Musician, Album
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class MusicianInline(admin.StackedInline):
|
|
96
|
+
model = Musician
|
|
97
|
+
extra = 1
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class AlbumInline(admin.TabularInline):
|
|
101
|
+
model = Album
|
|
102
|
+
extra = 1
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@admin.register(Band)
|
|
106
|
+
class BandAdmin(TabbedModelAdmin):
|
|
107
|
+
model = Band
|
|
108
|
+
|
|
109
|
+
tab_overview = (
|
|
110
|
+
(None, {
|
|
111
|
+
'fields': ('name', 'bio', 'style')
|
|
112
|
+
}),
|
|
113
|
+
MusicianInline,
|
|
114
|
+
('Contact', {
|
|
115
|
+
'fields': ('agent', 'phone', 'email')
|
|
116
|
+
})
|
|
117
|
+
)
|
|
118
|
+
tab_album = (
|
|
119
|
+
AlbumInline,
|
|
120
|
+
)
|
|
121
|
+
tabs = [
|
|
122
|
+
('Overview', tab_overview),
|
|
123
|
+
('Albums', tab_album)
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
**************************
|
|
127
|
+
Configure tabs dynamically
|
|
128
|
+
**************************
|
|
129
|
+
|
|
130
|
+
Be warned that the tabs will completely reset the fieldsets and inlines attributes in order to avoid conflicts during the form saving. Both attributes are overwritten with the entries passed to the tabs attribute. For the same reasons, it is highly recommanded not to overwrite get_fieldsets or get_inlines.
|
|
131
|
+
|
|
132
|
+
You can pass and modify the tabs dynamically the same way you would do for fieldsets or inlines.
|
|
133
|
+
|
|
134
|
+
.. code-block:: python
|
|
135
|
+
|
|
136
|
+
def get_tabs(self, request, obj=None):
|
|
137
|
+
tabs = self.tabs
|
|
138
|
+
if obj is not None:
|
|
139
|
+
tab_overview = self.tab_overview + ('Social', {
|
|
140
|
+
'fields': ('website', 'twitter', 'facebook')
|
|
141
|
+
})
|
|
142
|
+
tab_ressources = self.tab_ressources + (InterviewInline, )
|
|
143
|
+
tabs = [
|
|
144
|
+
('Overview', tab_overview),
|
|
145
|
+
('Ressources', tab_ressources)
|
|
146
|
+
]
|
|
147
|
+
self.tabs = tabs
|
|
148
|
+
return super(BandAdmin, self).get_tabs(request, obj)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
********************
|
|
152
|
+
Change the jquery ui
|
|
153
|
+
********************
|
|
154
|
+
|
|
155
|
+
You can change the jquery ui css and js by either overriding the media in the
|
|
156
|
+
admin class
|
|
157
|
+
|
|
158
|
+
.. code-block:: python
|
|
159
|
+
|
|
160
|
+
class Media:
|
|
161
|
+
css = {
|
|
162
|
+
'all': ('css/jquery-ui.theme.min.css',)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
or by changing the the following settings,
|
|
166
|
+
|
|
167
|
+
`TABBED_ADMIN_JQUERY_UI_CSS` and `TABBED_ADMIN_JQUERY_UI_JS`
|
|
168
|
+
|
|
169
|
+
.. code-block:: python
|
|
170
|
+
|
|
171
|
+
TABBED_ADMIN_JQUERY_UI_CSS = 'static/css/my-custom-jquery-ui.css'
|
|
172
|
+
TABBED_ADMIN_JQUERY_UI_JS = 'static/js/my-custom-jquery-ui.js'
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
Contribution
|
|
176
|
+
************
|
|
177
|
+
|
|
178
|
+
Please feel free to contribute. Any help and advices are much appreciated.
|
|
179
|
+
You will find an example application to run and develop the library easily.
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
*****
|
|
183
|
+
LINKS
|
|
184
|
+
*****
|
|
185
|
+
|
|
186
|
+
Development:
|
|
187
|
+
https://github.com/mgaller/django-tabbed-admin3
|
|
188
|
+
|
|
189
|
+
Package:
|
|
190
|
+
https://pypi.python.org/pypi/django-tabbed-admin3
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django-tabbed-admin3
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Easily add tabs to django admin forms.
|
|
5
|
+
Author: Michael Galler
|
|
6
|
+
Author-email: mgaller@live.de
|
|
7
|
+
License: BSD License
|
|
8
|
+
Platform: OS Independent
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
18
|
+
License-File: LICENSE.txt
|
|
19
|
+
License-File: AUTHORS.txt
|
|
20
|
+
|
|
21
|
+
###################
|
|
22
|
+
Django tabbed admin
|
|
23
|
+
###################
|
|
24
|
+
|
|
25
|
+
This is a simple fork of django-tabbed-admin https://github.com/omji/django-tabbed-admin with Django 4.x fix.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Simple library to easilly add tabs to admin forms. It also allows users to re-order inlines and fieldsets.
|
|
29
|
+
Django tabbed admin is compatible with django-grappelli and django-gipsy.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
*******
|
|
33
|
+
Install
|
|
34
|
+
*******
|
|
35
|
+
|
|
36
|
+
It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv.
|
|
37
|
+
|
|
38
|
+
From PyPi
|
|
39
|
+
|
|
40
|
+
.. code-block:: shell-session
|
|
41
|
+
|
|
42
|
+
pip install django-tabbed-admin3
|
|
43
|
+
|
|
44
|
+
From Github
|
|
45
|
+
|
|
46
|
+
.. code-block:: shell-session
|
|
47
|
+
|
|
48
|
+
https://github.com/mgaller/django-tabbed-admin3#egg=tabbed_admin
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
*****
|
|
52
|
+
setup
|
|
53
|
+
*****
|
|
54
|
+
|
|
55
|
+
Simply add the app in your installed apps list in settings.py
|
|
56
|
+
|
|
57
|
+
.. code-block:: python
|
|
58
|
+
|
|
59
|
+
INSTALLED_APPS = (
|
|
60
|
+
...
|
|
61
|
+
'tabbed_admin'
|
|
62
|
+
...
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
Django-tabbed-admin by default requires Jquery UI tabs plugin in order to work. It is packaged with the static files required to make it funcitonnal, however, they are not activated by default to avoid a conflict with other libraries.
|
|
66
|
+
|
|
67
|
+
In order to activate the Jquery UI statics, add the following line to the project settings:
|
|
68
|
+
|
|
69
|
+
.. code-block:: python
|
|
70
|
+
|
|
71
|
+
TABBED_ADMIN_USE_JQUERY_UI = True
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
********************
|
|
75
|
+
Configure admin tabs
|
|
76
|
+
********************
|
|
77
|
+
|
|
78
|
+
In order to add tabs to a model admin, it should inherit from tabbed_admin.TabbedModelAdmin and contain a tabs attribute.
|
|
79
|
+
The tab attribute configuration tries to remain similar to the fieldsets and inlines setup logic.
|
|
80
|
+
|
|
81
|
+
Basically, a tuple can be created for each tab exactely the same way as for fieldsets, except that inlines can be added anywhere in between.
|
|
82
|
+
|
|
83
|
+
.. code-block:: python
|
|
84
|
+
|
|
85
|
+
tab_overview = (
|
|
86
|
+
(None, {
|
|
87
|
+
'fields': ('name', 'bio', 'style')
|
|
88
|
+
}),
|
|
89
|
+
MusicianInline,
|
|
90
|
+
('Contact', {
|
|
91
|
+
'fields': ('agent', 'phone', 'email')
|
|
92
|
+
})
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
Then each tuple have to be passed to a *tabs* attribute prefixed by the verbose name to display within the tab:
|
|
96
|
+
|
|
97
|
+
.. code-block:: python
|
|
98
|
+
|
|
99
|
+
tabs = [
|
|
100
|
+
('Overview', tab_overview),
|
|
101
|
+
('Albums', tab_album)
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
A full example would give:
|
|
106
|
+
|
|
107
|
+
.. code-block:: python
|
|
108
|
+
|
|
109
|
+
from django.contrib import admin
|
|
110
|
+
|
|
111
|
+
from tabbed_admin import TabbedModelAdmin
|
|
112
|
+
from .models import Band, Musician, Album
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class MusicianInline(admin.StackedInline):
|
|
116
|
+
model = Musician
|
|
117
|
+
extra = 1
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class AlbumInline(admin.TabularInline):
|
|
121
|
+
model = Album
|
|
122
|
+
extra = 1
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@admin.register(Band)
|
|
126
|
+
class BandAdmin(TabbedModelAdmin):
|
|
127
|
+
model = Band
|
|
128
|
+
|
|
129
|
+
tab_overview = (
|
|
130
|
+
(None, {
|
|
131
|
+
'fields': ('name', 'bio', 'style')
|
|
132
|
+
}),
|
|
133
|
+
MusicianInline,
|
|
134
|
+
('Contact', {
|
|
135
|
+
'fields': ('agent', 'phone', 'email')
|
|
136
|
+
})
|
|
137
|
+
)
|
|
138
|
+
tab_album = (
|
|
139
|
+
AlbumInline,
|
|
140
|
+
)
|
|
141
|
+
tabs = [
|
|
142
|
+
('Overview', tab_overview),
|
|
143
|
+
('Albums', tab_album)
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
**************************
|
|
147
|
+
Configure tabs dynamically
|
|
148
|
+
**************************
|
|
149
|
+
|
|
150
|
+
Be warned that the tabs will completely reset the fieldsets and inlines attributes in order to avoid conflicts during the form saving. Both attributes are overwritten with the entries passed to the tabs attribute. For the same reasons, it is highly recommanded not to overwrite get_fieldsets or get_inlines.
|
|
151
|
+
|
|
152
|
+
You can pass and modify the tabs dynamically the same way you would do for fieldsets or inlines.
|
|
153
|
+
|
|
154
|
+
.. code-block:: python
|
|
155
|
+
|
|
156
|
+
def get_tabs(self, request, obj=None):
|
|
157
|
+
tabs = self.tabs
|
|
158
|
+
if obj is not None:
|
|
159
|
+
tab_overview = self.tab_overview + ('Social', {
|
|
160
|
+
'fields': ('website', 'twitter', 'facebook')
|
|
161
|
+
})
|
|
162
|
+
tab_ressources = self.tab_ressources + (InterviewInline, )
|
|
163
|
+
tabs = [
|
|
164
|
+
('Overview', tab_overview),
|
|
165
|
+
('Ressources', tab_ressources)
|
|
166
|
+
]
|
|
167
|
+
self.tabs = tabs
|
|
168
|
+
return super(BandAdmin, self).get_tabs(request, obj)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
********************
|
|
172
|
+
Change the jquery ui
|
|
173
|
+
********************
|
|
174
|
+
|
|
175
|
+
You can change the jquery ui css and js by either overriding the media in the
|
|
176
|
+
admin class
|
|
177
|
+
|
|
178
|
+
.. code-block:: python
|
|
179
|
+
|
|
180
|
+
class Media:
|
|
181
|
+
css = {
|
|
182
|
+
'all': ('css/jquery-ui.theme.min.css',)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
or by changing the the following settings,
|
|
186
|
+
|
|
187
|
+
`TABBED_ADMIN_JQUERY_UI_CSS` and `TABBED_ADMIN_JQUERY_UI_JS`
|
|
188
|
+
|
|
189
|
+
.. code-block:: python
|
|
190
|
+
|
|
191
|
+
TABBED_ADMIN_JQUERY_UI_CSS = 'static/css/my-custom-jquery-ui.css'
|
|
192
|
+
TABBED_ADMIN_JQUERY_UI_JS = 'static/js/my-custom-jquery-ui.js'
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
Contribution
|
|
196
|
+
************
|
|
197
|
+
|
|
198
|
+
Please feel free to contribute. Any help and advices are much appreciated.
|
|
199
|
+
You will find an example application to run and develop the library easily.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
*****
|
|
203
|
+
LINKS
|
|
204
|
+
*****
|
|
205
|
+
|
|
206
|
+
Development:
|
|
207
|
+
https://github.com/mgaller/django-tabbed-admin3
|
|
208
|
+
|
|
209
|
+
Package:
|
|
210
|
+
https://pypi.python.org/pypi/django-tabbed-admin3
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
AUTHORS.txt
|
|
2
|
+
LICENSE.txt
|
|
3
|
+
MANIFEST.in
|
|
4
|
+
README.rst
|
|
5
|
+
setup.cfg
|
|
6
|
+
setup.py
|
|
7
|
+
django_tabbed_admin3.egg-info/PKG-INFO
|
|
8
|
+
django_tabbed_admin3.egg-info/SOURCES.txt
|
|
9
|
+
django_tabbed_admin3.egg-info/dependency_links.txt
|
|
10
|
+
django_tabbed_admin3.egg-info/top_level.txt
|
|
11
|
+
tabbed_admin/__init__.py
|
|
12
|
+
tabbed_admin/admin.py
|
|
13
|
+
tabbed_admin/models.py
|
|
14
|
+
tabbed_admin/settings.py
|
|
15
|
+
tabbed_admin/static/tabbed_admin/css/jquery-ui-1.11.4.min.css
|
|
16
|
+
tabbed_admin/static/tabbed_admin/css/tabbed_admin.css
|
|
17
|
+
tabbed_admin/static/tabbed_admin/css/tabbed_grappelli_admin.css
|
|
18
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_0_aaaaaa_40x100.png
|
|
19
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_0_eeeeee_40x100.png
|
|
20
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_55_c0402a_40x100.png
|
|
21
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_flat_55_eeeeee_40x100.png
|
|
22
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_glass_100_f8f8f8_1x400.png
|
|
23
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_glass_35_dddddd_1x400.png
|
|
24
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_glass_60_eeeeee_1x400.png
|
|
25
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_inset-hard_75_999999_1x100.png
|
|
26
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-bg_inset-soft_50_c9c9c9_1x100.png
|
|
27
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_3383bb_256x240.png
|
|
28
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_444444_256x240.png
|
|
29
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_454545_256x240.png
|
|
30
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_555555_256x240.png
|
|
31
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_70b2e1_256x240.png
|
|
32
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_777620_256x240.png
|
|
33
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_777777_256x240.png
|
|
34
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_999999_256x240.png
|
|
35
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_cc0000_256x240.png
|
|
36
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_fbc856_256x240.png
|
|
37
|
+
tabbed_admin/static/tabbed_admin/css/images/ui-icons_ffffff_256x240.png
|
|
38
|
+
tabbed_admin/static/tabbed_admin/js/jquery-ui-1.11.4.min.js
|
|
39
|
+
tabbed_admin/templates/tabbed_admin/change_form.html
|
|
40
|
+
tabbed_admin/templatetags/__init__.py
|
|
41
|
+
tabbed_admin/templatetags/tabbed_admin_tags.py
|
|
42
|
+
tabbed_admin/tests/__init__.py
|
|
43
|
+
tabbed_admin/tests/admin.py
|
|
44
|
+
tabbed_admin/tests/models.py
|
|
45
|
+
tabbed_admin/tests/runtests.py
|
|
46
|
+
tabbed_admin/tests/tests.py
|
|
47
|
+
tabbed_admin/tests/urls.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tabbed_admin
|