django_fhadmin 1.4.0__py2-none-any.whl
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_fhadmin-1.4.0.dist-info/DESCRIPTION.rst +112 -0
- django_fhadmin-1.4.0.dist-info/METADATA +122 -0
- django_fhadmin-1.4.0.dist-info/RECORD +15 -0
- django_fhadmin-1.4.0.dist-info/WHEEL +5 -0
- django_fhadmin-1.4.0.dist-info/metadata.json +1 -0
- django_fhadmin-1.4.0.dist-info/top_level.txt +1 -0
- fhadmin/__init__.py +4 -0
- fhadmin/models.py +0 -0
- fhadmin/static/fhadmin/fhadmin.css +59 -0
- fhadmin/static/fhadmin/main-menu-icon.png +0 -0
- fhadmin/templates/admin/base_site.html +19 -0
- fhadmin/templates/admin/group_list.html +48 -0
- fhadmin/templates/admin/index.html +50 -0
- fhadmin/templatetags/__init__.py +0 -0
- fhadmin/templatetags/fhadmin_module_groups.py +120 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Django-FHAdmin
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
Modifies the stock Django-Administration interface to fit our ideas a little
|
|
5
|
+
bit better.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Dashboard and global navigation extension
|
|
9
|
+
-----------------------------------------
|
|
10
|
+
|
|
11
|
+
Allows grouping of apps on the dashboard and offers the same view on each
|
|
12
|
+
admin page by sliding down the bar on top after a small delay when hovered.
|
|
13
|
+
|
|
14
|
+
Configuration example::
|
|
15
|
+
|
|
16
|
+
from fhadmin import FHADMIN_GROUPS_REMAINING
|
|
17
|
+
_ = lambda x: x
|
|
18
|
+
|
|
19
|
+
FHADMIN_GROUPS_CONFIG = [
|
|
20
|
+
(_('Main content'), {
|
|
21
|
+
'apps': ('page', 'medialibrary', 'blog'),
|
|
22
|
+
}),
|
|
23
|
+
(_('Modules'), {
|
|
24
|
+
'apps': ('links', FHADMIN_GROUPS_REMAINING),
|
|
25
|
+
}),
|
|
26
|
+
(_('Preferences'), {
|
|
27
|
+
'apps': ('auth', 'rosetta', 'external', 'sites'),
|
|
28
|
+
}),
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
The extension is activated by overriding both ``admin/base_site.html`` for the
|
|
33
|
+
slide-down navigation and ``admin/index.html`` for the dashboard, and adding
|
|
34
|
+
``fhadmin`` to ``INSTALLED_APPS`` so that the template tags and static files
|
|
35
|
+
are found. The following two templates are contained in
|
|
36
|
+
``fhadmin/templates/admin`` as well.
|
|
37
|
+
|
|
38
|
+
``admin/base_site.html``::
|
|
39
|
+
|
|
40
|
+
{% extends "admin/base.html" %}
|
|
41
|
+
{% load i18n %}
|
|
42
|
+
|
|
43
|
+
{% block extrahead %}
|
|
44
|
+
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}fhadmin/fhadmin.css" />
|
|
45
|
+
{% endblock %}
|
|
46
|
+
|
|
47
|
+
{% block title %}{{ title }} | {% trans 'Django administration' %}{% endblock %}
|
|
48
|
+
|
|
49
|
+
{% block branding %}
|
|
50
|
+
<h1 id="site-name">{% trans 'Django administration' %}</h1>
|
|
51
|
+
{% endblock %}
|
|
52
|
+
|
|
53
|
+
{% block nav-global %}
|
|
54
|
+
<div id="quickpanel">
|
|
55
|
+
{% include "admin/group_list.html" %}
|
|
56
|
+
<br style="clear:both" />
|
|
57
|
+
</div>
|
|
58
|
+
{% endblock %}
|
|
59
|
+
|
|
60
|
+
``admin/index.html``::
|
|
61
|
+
|
|
62
|
+
{% extends "admin/base_site.html" %}
|
|
63
|
+
{% load i18n admin_static %}
|
|
64
|
+
|
|
65
|
+
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />{% endblock %}
|
|
66
|
+
|
|
67
|
+
{% block coltype %}colMS{% endblock %}
|
|
68
|
+
|
|
69
|
+
{% block bodyclass %}dashboard{% endblock %}
|
|
70
|
+
|
|
71
|
+
{% block breadcrumbs %}{% endblock %}
|
|
72
|
+
|
|
73
|
+
{% block content %}
|
|
74
|
+
<div id="content-main">
|
|
75
|
+
{% include "admin/group_list.html" %}
|
|
76
|
+
<br style="clear:left" />
|
|
77
|
+
</div>
|
|
78
|
+
{% endblock %}
|
|
79
|
+
|
|
80
|
+
{% block sidebar %}
|
|
81
|
+
<div id="content-related">
|
|
82
|
+
<div class="module" id="recent-actions-module">
|
|
83
|
+
<h2>{% trans 'Recent Actions' %}</h2>
|
|
84
|
+
<h3>{% trans 'My Actions' %}</h3>
|
|
85
|
+
{% load log %}
|
|
86
|
+
{% get_admin_log 10 as admin_log for_user user %}
|
|
87
|
+
{% if not admin_log %}
|
|
88
|
+
<p>{% trans 'None available' %}</p>
|
|
89
|
+
{% else %}
|
|
90
|
+
<ul class="actionlist">
|
|
91
|
+
{% for entry in admin_log %}
|
|
92
|
+
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
|
|
93
|
+
{% if entry.is_deletion %}
|
|
94
|
+
{{ entry.object_repr }}
|
|
95
|
+
{% else %}
|
|
96
|
+
<a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
|
|
97
|
+
{% endif %}
|
|
98
|
+
<br/>
|
|
99
|
+
{% if entry.content_type %}
|
|
100
|
+
<span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span>
|
|
101
|
+
{% else %}
|
|
102
|
+
<span class="mini quiet">{% trans 'Unknown content' %}</span>
|
|
103
|
+
{% endif %}
|
|
104
|
+
</li>
|
|
105
|
+
{% endfor %}
|
|
106
|
+
</ul>
|
|
107
|
+
{% endif %}
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
{% endblock %}
|
|
111
|
+
|
|
112
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.0
|
|
2
|
+
Name: django-fhadmin
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: Modifies the stock Django-Administration interface to fit our ideas a little bit better.
|
|
5
|
+
Home-page: http://github.com/feinheit/django-fhadmin/
|
|
6
|
+
Author: Matthias Kestenholz
|
|
7
|
+
Author-email: mk@feinheit.ch
|
|
8
|
+
License: BSD License
|
|
9
|
+
Platform: OS Independent
|
|
10
|
+
|
|
11
|
+
Django-FHAdmin
|
|
12
|
+
==============
|
|
13
|
+
|
|
14
|
+
Modifies the stock Django-Administration interface to fit our ideas a little
|
|
15
|
+
bit better.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Dashboard and global navigation extension
|
|
19
|
+
-----------------------------------------
|
|
20
|
+
|
|
21
|
+
Allows grouping of apps on the dashboard and offers the same view on each
|
|
22
|
+
admin page by sliding down the bar on top after a small delay when hovered.
|
|
23
|
+
|
|
24
|
+
Configuration example::
|
|
25
|
+
|
|
26
|
+
from fhadmin import FHADMIN_GROUPS_REMAINING
|
|
27
|
+
_ = lambda x: x
|
|
28
|
+
|
|
29
|
+
FHADMIN_GROUPS_CONFIG = [
|
|
30
|
+
(_('Main content'), {
|
|
31
|
+
'apps': ('page', 'medialibrary', 'blog'),
|
|
32
|
+
}),
|
|
33
|
+
(_('Modules'), {
|
|
34
|
+
'apps': ('links', FHADMIN_GROUPS_REMAINING),
|
|
35
|
+
}),
|
|
36
|
+
(_('Preferences'), {
|
|
37
|
+
'apps': ('auth', 'rosetta', 'external', 'sites'),
|
|
38
|
+
}),
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
The extension is activated by overriding both ``admin/base_site.html`` for the
|
|
43
|
+
slide-down navigation and ``admin/index.html`` for the dashboard, and adding
|
|
44
|
+
``fhadmin`` to ``INSTALLED_APPS`` so that the template tags and static files
|
|
45
|
+
are found. The following two templates are contained in
|
|
46
|
+
``fhadmin/templates/admin`` as well.
|
|
47
|
+
|
|
48
|
+
``admin/base_site.html``::
|
|
49
|
+
|
|
50
|
+
{% extends "admin/base.html" %}
|
|
51
|
+
{% load i18n %}
|
|
52
|
+
|
|
53
|
+
{% block extrahead %}
|
|
54
|
+
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}fhadmin/fhadmin.css" />
|
|
55
|
+
{% endblock %}
|
|
56
|
+
|
|
57
|
+
{% block title %}{{ title }} | {% trans 'Django administration' %}{% endblock %}
|
|
58
|
+
|
|
59
|
+
{% block branding %}
|
|
60
|
+
<h1 id="site-name">{% trans 'Django administration' %}</h1>
|
|
61
|
+
{% endblock %}
|
|
62
|
+
|
|
63
|
+
{% block nav-global %}
|
|
64
|
+
<div id="quickpanel">
|
|
65
|
+
{% include "admin/group_list.html" %}
|
|
66
|
+
<br style="clear:both" />
|
|
67
|
+
</div>
|
|
68
|
+
{% endblock %}
|
|
69
|
+
|
|
70
|
+
``admin/index.html``::
|
|
71
|
+
|
|
72
|
+
{% extends "admin/base_site.html" %}
|
|
73
|
+
{% load i18n admin_static %}
|
|
74
|
+
|
|
75
|
+
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />{% endblock %}
|
|
76
|
+
|
|
77
|
+
{% block coltype %}colMS{% endblock %}
|
|
78
|
+
|
|
79
|
+
{% block bodyclass %}dashboard{% endblock %}
|
|
80
|
+
|
|
81
|
+
{% block breadcrumbs %}{% endblock %}
|
|
82
|
+
|
|
83
|
+
{% block content %}
|
|
84
|
+
<div id="content-main">
|
|
85
|
+
{% include "admin/group_list.html" %}
|
|
86
|
+
<br style="clear:left" />
|
|
87
|
+
</div>
|
|
88
|
+
{% endblock %}
|
|
89
|
+
|
|
90
|
+
{% block sidebar %}
|
|
91
|
+
<div id="content-related">
|
|
92
|
+
<div class="module" id="recent-actions-module">
|
|
93
|
+
<h2>{% trans 'Recent Actions' %}</h2>
|
|
94
|
+
<h3>{% trans 'My Actions' %}</h3>
|
|
95
|
+
{% load log %}
|
|
96
|
+
{% get_admin_log 10 as admin_log for_user user %}
|
|
97
|
+
{% if not admin_log %}
|
|
98
|
+
<p>{% trans 'None available' %}</p>
|
|
99
|
+
{% else %}
|
|
100
|
+
<ul class="actionlist">
|
|
101
|
+
{% for entry in admin_log %}
|
|
102
|
+
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
|
|
103
|
+
{% if entry.is_deletion %}
|
|
104
|
+
{{ entry.object_repr }}
|
|
105
|
+
{% else %}
|
|
106
|
+
<a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
|
|
107
|
+
{% endif %}
|
|
108
|
+
<br/>
|
|
109
|
+
{% if entry.content_type %}
|
|
110
|
+
<span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span>
|
|
111
|
+
{% else %}
|
|
112
|
+
<span class="mini quiet">{% trans 'Unknown content' %}</span>
|
|
113
|
+
{% endif %}
|
|
114
|
+
</li>
|
|
115
|
+
{% endfor %}
|
|
116
|
+
</ul>
|
|
117
|
+
{% endif %}
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
{% endblock %}
|
|
121
|
+
|
|
122
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
django_fhadmin-1.4.0.dist-info/DESCRIPTION.rst,sha256=kzdo2V90biON9U3jHNL2_EmYToGy_YVKTkshtFHW0H8,3669
|
|
2
|
+
django_fhadmin-1.4.0.dist-info/METADATA,sha256=RXg0a_JzPfRw8XWfKXWoXM1c-3LNeH5MH5W1QhjsrN4,3983
|
|
3
|
+
django_fhadmin-1.4.0.dist-info/RECORD,,
|
|
4
|
+
django_fhadmin-1.4.0.dist-info/WHEEL,sha256=bee59qcPjkyXfMaxNWjl2CGotqfumWx9pC1hlVLr2mM,92
|
|
5
|
+
django_fhadmin-1.4.0.dist-info/metadata.json,sha256=l85MmAAn0GwxBDGAqWTq6cuaJRCZNyyZihLYf_l6lTE,523
|
|
6
|
+
django_fhadmin-1.4.0.dist-info/top_level.txt,sha256=K_aIxFl54EJbRhWz8-LdaWkS_Tfwd46pCxh1nn3kToU,8
|
|
7
|
+
fhadmin/__init__.py,sha256=dgWsye1qbAxo5EWDg1C1FqaPCBzd3J--jGAksLr-QIk,102
|
|
8
|
+
fhadmin/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
fhadmin/static/fhadmin/fhadmin.css,sha256=uSLtLdizPmIAyEKMNwEiECpdQXoThsihMJeXDdJCobY,1377
|
|
10
|
+
fhadmin/static/fhadmin/main-menu-icon.png,sha256=bbPwnyAQP5z1aUTKwTscRqbSNgwpwxUJRqIbGIfCxqM,1666
|
|
11
|
+
fhadmin/templates/admin/base_site.html,sha256=oYQcnHzj6vq-CmXE7X5G7j5trQy-eTT4deVU9bAzQaI,490
|
|
12
|
+
fhadmin/templates/admin/group_list.html,sha256=ysOabgXU3s5VaMtRPm1jS2DsRVEEVT1RALuHua2Pmqk,1718
|
|
13
|
+
fhadmin/templates/admin/index.html,sha256=5ULcY2NUi6Lub5-wgEcd80dT2mQmCsY5KDpchbfvGlM,1766
|
|
14
|
+
fhadmin/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
fhadmin/templatetags/fhadmin_module_groups.py,sha256=begmrEOItJ-KgX-h8WBYA06Aq307PExszPDX6JFiWR4,3992
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"extensions": {"python.details": {"contacts": [{"email": "mk@feinheit.ch", "name": "Matthias Kestenholz", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "http://github.com/feinheit/django-fhadmin/"}}}, "generator": "bdist_wheel (0.29.0)", "license": "BSD License", "metadata_version": "2.0", "name": "django-fhadmin", "platform": "OS Independent", "summary": "Modifies the stock Django-Administration interface to fit our ideas a little bit better.", "version": "1.4.0"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fhadmin
|
fhadmin/__init__.py
ADDED
fhadmin/models.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.dashboard #content.colMS { margin-right: 0 !important; }
|
|
2
|
+
.dashboard #content { width: auto; }
|
|
3
|
+
|
|
4
|
+
#content-related {
|
|
5
|
+
clear: both;
|
|
6
|
+
float: left;
|
|
7
|
+
width: 100%;
|
|
8
|
+
margin-top: 20px;
|
|
9
|
+
padding-bottom: 1px; /* contain the margin */
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.qp-active #branding h1 {
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
background-image: url(main-menu-icon.png);
|
|
15
|
+
background-repeat: no-repeat;
|
|
16
|
+
background-position: 7px 7px;
|
|
17
|
+
text-indent: 40px;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
}
|
|
21
|
+
.qp-active #branding h1:hover {
|
|
22
|
+
background-position: 7px -24px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.group {
|
|
26
|
+
float: left;
|
|
27
|
+
width: 250px;
|
|
28
|
+
margin-left: 20px;
|
|
29
|
+
}
|
|
30
|
+
.group:first-child {
|
|
31
|
+
margin-left: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.group h2 {
|
|
35
|
+
color: #447e9b;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dashboard .module table th {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#header { min-height: 40px; height: auto; }
|
|
43
|
+
#quickpanel { display: none; clear: both; line-height: normal; }
|
|
44
|
+
#quickpanel .group h2 { color: #ffffff; }
|
|
45
|
+
#quickpanel .module { background: inherit; color: #ffffff; }
|
|
46
|
+
#header #quickpanel a { color: #ffffff; }
|
|
47
|
+
|
|
48
|
+
#quickpanel .module,
|
|
49
|
+
#quickpanel th, #quickpanel td { border-color: #aaaaaa; }
|
|
50
|
+
|
|
51
|
+
.dashboard #content-main .module table td a,
|
|
52
|
+
#quickpanel .module table td a { display: block; padding-right: 0em; }
|
|
53
|
+
|
|
54
|
+
#quickpanel .module table th { width: 100%; }
|
|
55
|
+
#quickpanel tr:last-child td, #quickpanel tr:last-child th { border-bottom: none; }
|
|
56
|
+
|
|
57
|
+
#quickpanel .caption {
|
|
58
|
+
color: #3b3b3b;
|
|
59
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{% extends "admin/base.html" %}
|
|
2
|
+
{% load i18n %}
|
|
3
|
+
|
|
4
|
+
{% block extrahead %}
|
|
5
|
+
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}fhadmin/fhadmin.css" />
|
|
6
|
+
{% endblock %}
|
|
7
|
+
|
|
8
|
+
{% block title %}{{ title }} | {% trans 'Django administration' %}{% endblock %}
|
|
9
|
+
|
|
10
|
+
{% block branding %}
|
|
11
|
+
<h1 id="site-name">{% trans 'Django administration' %}</h1>
|
|
12
|
+
{% endblock %}
|
|
13
|
+
|
|
14
|
+
{% block nav-global %}
|
|
15
|
+
<div id="quickpanel">
|
|
16
|
+
{% include "admin/group_list.html" %}
|
|
17
|
+
<br style="clear:both" />
|
|
18
|
+
</div>
|
|
19
|
+
{% endblock %}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{% load fhadmin_module_groups i18n %}
|
|
2
|
+
{% fhadmin_group_list request %}
|
|
3
|
+
|
|
4
|
+
{% if group_list %}
|
|
5
|
+
{% for group, app_list in group_list %}
|
|
6
|
+
<div class="group">
|
|
7
|
+
<h2>{% trans group %}</h2>
|
|
8
|
+
{% for app in app_list %}
|
|
9
|
+
<div class="module">
|
|
10
|
+
<table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
|
|
11
|
+
<caption class="caption {{ app.name|lower }}"><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
|
|
12
|
+
{% for model in app.models %}
|
|
13
|
+
<tr>
|
|
14
|
+
{% if model.perms.change %}
|
|
15
|
+
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
|
|
16
|
+
{% else %}
|
|
17
|
+
<th scope="row">{{ model.name }}</th>
|
|
18
|
+
{% endif %}
|
|
19
|
+
|
|
20
|
+
{% if model.perms.add %}
|
|
21
|
+
<td><a href="{{ model.admin_url }}add/" class="addlink"> </a></td>
|
|
22
|
+
{% else %}
|
|
23
|
+
<td> </td>
|
|
24
|
+
{% endif %}
|
|
25
|
+
</tr>
|
|
26
|
+
{% endfor %}
|
|
27
|
+
</table>
|
|
28
|
+
</div>
|
|
29
|
+
{% endfor %}
|
|
30
|
+
</div>
|
|
31
|
+
{% endfor %}
|
|
32
|
+
<script type="text/javascript">
|
|
33
|
+
if (window.django && window.django.jQuery) {
|
|
34
|
+
(function($){
|
|
35
|
+
$(function(){
|
|
36
|
+
$('head').append('<style type="text/css">#header h1:hover { cursor: pointer; }\x3C/style>');
|
|
37
|
+
var quickpanel = $('#quickpanel');
|
|
38
|
+
$('body').addClass('qp-active');
|
|
39
|
+
$('#header h1').bind('click', function() {
|
|
40
|
+
quickpanel.slideToggle();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
})(django.jQuery);
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
{% else %}
|
|
47
|
+
<p>{% trans "You don't have permission to edit anything." %}</p>
|
|
48
|
+
{% endif %}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{% extends "admin/base_site.html" %}
|
|
2
|
+
{% load i18n admin_static %}
|
|
3
|
+
|
|
4
|
+
{% block extrastyle %}{{ block.super }}
|
|
5
|
+
<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />{% endblock %}
|
|
6
|
+
|
|
7
|
+
{% block coltype %}colMS{% endblock %}
|
|
8
|
+
|
|
9
|
+
{% block bodyclass %}dashboard{% endblock %}
|
|
10
|
+
|
|
11
|
+
{% block breadcrumbs %}{% endblock %}
|
|
12
|
+
|
|
13
|
+
{% block content %}
|
|
14
|
+
<div id="content-main">
|
|
15
|
+
{% include "admin/group_list.html" %}
|
|
16
|
+
<br style="clear:left" />
|
|
17
|
+
</div>
|
|
18
|
+
{% endblock %}
|
|
19
|
+
|
|
20
|
+
{% block sidebar %}
|
|
21
|
+
<div id="content-related">
|
|
22
|
+
<div class="module" id="recent-actions-module">
|
|
23
|
+
<h2>{% trans 'Recent Actions' %}</h2>
|
|
24
|
+
<h3>{% trans 'My Actions' %}</h3>
|
|
25
|
+
{% load log %}
|
|
26
|
+
{% get_admin_log 10 as admin_log for_user user %}
|
|
27
|
+
{% if not admin_log %}
|
|
28
|
+
<p>{% trans 'None available' %}</p>
|
|
29
|
+
{% else %}
|
|
30
|
+
<ul class="actionlist">
|
|
31
|
+
{% for entry in admin_log %}
|
|
32
|
+
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
|
|
33
|
+
{% if entry.is_deletion %}
|
|
34
|
+
{{ entry.object_repr }}
|
|
35
|
+
{% else %}
|
|
36
|
+
<a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
|
|
37
|
+
{% endif %}
|
|
38
|
+
<br/>
|
|
39
|
+
{% if entry.content_type %}
|
|
40
|
+
<span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span>
|
|
41
|
+
{% else %}
|
|
42
|
+
<span class="mini quiet">{% trans 'Unknown content' %}</span>
|
|
43
|
+
{% endif %}
|
|
44
|
+
</li>
|
|
45
|
+
{% endfor %}
|
|
46
|
+
</ul>
|
|
47
|
+
{% endif %}
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
{% endblock %}
|
|
File without changes
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from __future__ import absolute_import, unicode_literals
|
|
2
|
+
|
|
3
|
+
import operator
|
|
4
|
+
|
|
5
|
+
from django import template
|
|
6
|
+
from django.conf import settings
|
|
7
|
+
from django.contrib import admin
|
|
8
|
+
from django.core.urlresolvers import reverse
|
|
9
|
+
from django.utils.safestring import mark_safe
|
|
10
|
+
from django.utils.text import capfirst
|
|
11
|
+
from django.utils.translation import ugettext_lazy
|
|
12
|
+
|
|
13
|
+
from fhadmin import FHADMIN_GROUPS_REMAINING
|
|
14
|
+
|
|
15
|
+
register = template.Library()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
FHADMIN_GROUPS_CONFIG = [
|
|
19
|
+
(ugettext_lazy('Main content'), {
|
|
20
|
+
'apps': ('page', 'medialibrary', 'elephantblog'),
|
|
21
|
+
}),
|
|
22
|
+
(ugettext_lazy('Modules'), {
|
|
23
|
+
'apps': ('gallery', 'agenda', 'links', FHADMIN_GROUPS_REMAINING),
|
|
24
|
+
}),
|
|
25
|
+
(ugettext_lazy('Preferences'), {
|
|
26
|
+
'apps': ('auth', 'sites', 'pinging'),
|
|
27
|
+
}),
|
|
28
|
+
(ugettext_lazy('Collections'), {
|
|
29
|
+
'apps': ('external', 'sharing', 'newsletter', 'form_designer'),
|
|
30
|
+
}),
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
FHADMIN_GROUPS_CONFIG = getattr(
|
|
34
|
+
settings, 'FHADMIN_GROUPS_CONFIG', FHADMIN_GROUPS_CONFIG)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def fhadmin_group_list(admin_site, request):
|
|
38
|
+
base_url = reverse('admin:index')
|
|
39
|
+
|
|
40
|
+
# -- 8< -- copied from django.contrib.admin.sites.AdminSite.index
|
|
41
|
+
app_dict = {}
|
|
42
|
+
user = request.user
|
|
43
|
+
for model, model_admin in admin_site._registry.items():
|
|
44
|
+
app_label = model._meta.app_label
|
|
45
|
+
has_module_perms = user.has_module_perms(app_label)
|
|
46
|
+
|
|
47
|
+
if has_module_perms:
|
|
48
|
+
perms = model_admin.get_model_perms(request)
|
|
49
|
+
|
|
50
|
+
# Check whether user has any perm for this module.
|
|
51
|
+
# If so, add the module to the model_list.
|
|
52
|
+
if True in perms.values():
|
|
53
|
+
model_dict = {
|
|
54
|
+
'name': capfirst(model._meta.verbose_name_plural),
|
|
55
|
+
'admin_url': base_url + mark_safe(
|
|
56
|
+
'%s/%s/' % (app_label, model.__name__.lower())),
|
|
57
|
+
'perms': perms,
|
|
58
|
+
}
|
|
59
|
+
if app_label in app_dict:
|
|
60
|
+
app_dict[app_label]['models'].append(model_dict)
|
|
61
|
+
else:
|
|
62
|
+
app_dict[app_label] = {
|
|
63
|
+
'name': app_label.title(),
|
|
64
|
+
'app_url': base_url + app_label + '/',
|
|
65
|
+
'has_module_perms': has_module_perms,
|
|
66
|
+
'models': [model_dict],
|
|
67
|
+
'app_label': app_label, # MK added this
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# Sort the apps alphabetically.
|
|
71
|
+
app_list = app_dict.values()
|
|
72
|
+
app_list.sort(lambda x, y: cmp(x['name'], y['name']))
|
|
73
|
+
|
|
74
|
+
# Sort the models alphabetically within each app.
|
|
75
|
+
for app in app_list:
|
|
76
|
+
app['models'].sort(lambda x, y: cmp(x['name'], y['name']))
|
|
77
|
+
# -- 8< -- copied from django.contrib.admin.sites.AdminSite.index
|
|
78
|
+
|
|
79
|
+
all_available = [app['app_label'] for app in app_list]
|
|
80
|
+
all_configured = reduce(
|
|
81
|
+
operator.add,
|
|
82
|
+
(list(v['apps']) for k, v in FHADMIN_GROUPS_CONFIG),
|
|
83
|
+
[])
|
|
84
|
+
|
|
85
|
+
all_remains = [a for a in all_available if a not in all_configured]
|
|
86
|
+
|
|
87
|
+
for group_title, group in FHADMIN_GROUPS_CONFIG:
|
|
88
|
+
apps = []
|
|
89
|
+
for app in group['apps']:
|
|
90
|
+
if app == FHADMIN_GROUPS_REMAINING:
|
|
91
|
+
apps.extend(app_dict[a] for a in all_remains if a in app_dict)
|
|
92
|
+
elif app in app_dict:
|
|
93
|
+
apps.append(app_dict[app])
|
|
94
|
+
# else: Do nothing, ignore
|
|
95
|
+
|
|
96
|
+
if apps:
|
|
97
|
+
yield group_title, apps
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class FHAdminGroupListNode(template.Node):
|
|
101
|
+
def __init__(self, request):
|
|
102
|
+
self.request = template.Variable(request)
|
|
103
|
+
|
|
104
|
+
def render(self, context):
|
|
105
|
+
request = self.request.resolve(context)
|
|
106
|
+
context['group_list'] = fhadmin_group_list(admin.sites.site, request)
|
|
107
|
+
return ''
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def do_fhadmin_group_list(parser, token):
|
|
111
|
+
"""
|
|
112
|
+
{% fhadmin_group_list request %}
|
|
113
|
+
|
|
114
|
+
Creates a ``group_list`` variable in the current context.
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
tag_name, request = token.split_contents()
|
|
118
|
+
return FHAdminGroupListNode(request)
|
|
119
|
+
|
|
120
|
+
register.tag('fhadmin_group_list', do_fhadmin_group_list)
|