django_fhadmin 2.3.0__py3-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.
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2011-2012, FEINHEIT GmbH and individual contributors.
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
+ 1. Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of FEINHEIT GmbH 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 OWNER 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,65 @@
1
+ Metadata-Version: 2.1
2
+ Name: django_fhadmin
3
+ Version: 2.3.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-3-Clause
9
+ Platform: OS Independent
10
+ Classifier: License :: OSI Approved :: BSD License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/x-rst
18
+ License-File: LICENSE
19
+ Requires-Dist: Django >=3.2
20
+ Provides-Extra: tests
21
+ Requires-Dist: coverage ; extra == 'tests'
22
+
23
+ Django-FHAdmin
24
+ ==============
25
+
26
+ Modifies the stock Django-Administration interface to fit our ideas a little
27
+ bit better.
28
+
29
+
30
+ Dashboard and global navigation extension
31
+ -----------------------------------------
32
+
33
+ Allows grouping of apps on the dashboard and offers the same view on each
34
+ admin page when clicking the main title of the Django admin interface.
35
+
36
+ App label entries without a matching app are ignored. A configuration example
37
+ follows:
38
+
39
+ .. code-block:: python
40
+
41
+ from fhadmin import FHADMIN_GROUPS_REMAINING
42
+ _ = lambda x: x
43
+
44
+ FHADMIN_GROUPS = [
45
+ (_('Main content'), ('page', 'medialibrary', 'blog')),
46
+ (_('Modules'), ('links', FHADMIN_GROUPS_REMAINING)),
47
+ (_('Preferences'), ('auth', 'rosetta', 'external', 'sites')),
48
+ ]
49
+
50
+
51
+ The extension is activated by inserting ``fhadmin`` before
52
+ ``django.contrib.admin`` in ``INSTALLED_APPS``.
53
+
54
+
55
+ Merging apps
56
+ ------------
57
+
58
+ Merging apps is possible as follows:
59
+
60
+ .. code-block:: python
61
+
62
+ FHADMIN_MERGE = {"accounts": "auth"}
63
+
64
+ This example moves all models from the ``accounts`` app to the ``auth``
65
+ heading. Entries where source and target do not exist are ignored.
@@ -0,0 +1,17 @@
1
+ fhadmin/__init__.py,sha256=ThzE0JoxYDSs-7R3Z7k3GM2hh5rYWLXoaWD0od0nPZ0,102
2
+ fhadmin/apps.py,sha256=V__LphvgIGMekFXQ_ErIsP9x7RcVBy45M56Vo6hIL6I,199
3
+ fhadmin/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ fhadmin/locale/de/LC_MESSAGES/django.mo,sha256=mPf_bUVdZ-u2h9oCJtbTNZ2Gi7QV_y80QaufgsQcl3I,782
5
+ fhadmin/locale/de/LC_MESSAGES/django.po,sha256=0xZRJ-H3nWrNs9H_vlB4IzlCEq3pPzyYQFOb5I77S0s,1238
6
+ fhadmin/static/fhadmin/fhadmin.css,sha256=lcovinhuxqqosf8Afyd9iG8IulhfEb5PQ32Ldky7v94,1649
7
+ fhadmin/static/fhadmin/fhadmin.js,sha256=R5fLOEyGjv4Tp4H_BQqMs2p-El-PZv35eIPksFlTAOM,471
8
+ fhadmin/templates/admin/base_site.html,sha256=G3NdiZPsD3pjNkHVqa8Lnw49G484_P5pth3eEjlEBFY,463
9
+ fhadmin/templates/admin/group_list.html,sha256=eQwTpY3oa-GNG6dGJcDVVMIjSkfo7sRxLsdPJ-XiPSk,445
10
+ fhadmin/templates/admin/index.html,sha256=Ym95bTZCeVEouRxA0QZzgjLZzjhzX33uFoCEAiauDHY,176
11
+ fhadmin/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ fhadmin/templatetags/fhadmin_groups.py,sha256=nSMYdpTx0aEUYsCvAGa0dU7srS8HRk8oJlT3Yq0CSVY,2997
13
+ django_fhadmin-2.3.0.dist-info/LICENSE,sha256=EeStXy_qBePVTsM8AHL7fnHdVlyfAmRdMDArwiUh84o,1557
14
+ django_fhadmin-2.3.0.dist-info/METADATA,sha256=wCa3KeyS3-RY5MuZ_iInhiq6N3U671dnE_pFvJ5PZk0,1938
15
+ django_fhadmin-2.3.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
16
+ django_fhadmin-2.3.0.dist-info/top_level.txt,sha256=K_aIxFl54EJbRhWz8-LdaWkS_Tfwd46pCxh1nn3kToU,8
17
+ django_fhadmin-2.3.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ fhadmin
fhadmin/__init__.py ADDED
@@ -0,0 +1,4 @@
1
+ VERSION = (2, 3, 0)
2
+ __version__ = ".".join(map(str, VERSION))
3
+
4
+ FHADMIN_GROUPS_REMAINING = "REMAINING"
fhadmin/apps.py ADDED
@@ -0,0 +1,10 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class FHAdminConfig(AppConfig):
5
+ name = "fhadmin"
6
+
7
+ def ready(self):
8
+ from django.contrib import admin
9
+
10
+ admin.site.enable_nav_sidebar = False
Binary file
@@ -0,0 +1,45 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2022-02-26 19:19+0100\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "Language: \n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=UTF-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
+
21
+ #: templates/admin/base_site.html:10
22
+ msgid "Django administration"
23
+ msgstr "Django-Verwaltung"
24
+
25
+ #: templates/admin/group_list.html:11
26
+ msgid "You don’t have permission to view or edit anything."
27
+ msgstr ""
28
+ "Das Benutzerkonto besitzt nicht die nötigen Rechte, um etwas anzusehen oder "
29
+ "zu ändern."
30
+
31
+ #: templatetags/fhadmin_groups.py:17
32
+ msgid "Main content"
33
+ msgstr "Hauptinhalt"
34
+
35
+ #: templatetags/fhadmin_groups.py:28
36
+ msgid "Modules"
37
+ msgstr "Module"
38
+
39
+ #: templatetags/fhadmin_groups.py:37
40
+ msgid "Preferences"
41
+ msgstr "Einstellungen"
42
+
43
+ #: templatetags/fhadmin_groups.py:51
44
+ msgid "Collections"
45
+ msgstr "Kollektionen"
fhadmin/models.py ADDED
File without changes
@@ -0,0 +1,110 @@
1
+ @media (min-width: 1024px) {
2
+ #header {
3
+ flex-wrap: wrap;
4
+ }
5
+ }
6
+
7
+ .dashboard #content {
8
+ width: auto;
9
+ }
10
+
11
+ .dashboard #content.colMS {
12
+ margin-right: 0 !important;
13
+ }
14
+
15
+ #content-related {
16
+ clear: both;
17
+ float: left;
18
+ width: 100%;
19
+ margin-top: 20px;
20
+ padding-bottom: 1px; /* contain the margin */
21
+ }
22
+
23
+ .qp-active #branding h1 {
24
+ cursor: pointer;
25
+ }
26
+
27
+ .qp-active #branding h1::after {
28
+ content: "▲";
29
+ font-size: 0.6em;
30
+ display: inline-block;
31
+ position: relative;
32
+ top: 0;
33
+ left: 0.5em;
34
+ transform: rotate(180deg);
35
+ transition: 0.2s;
36
+ }
37
+
38
+ .qp-open #branding h1::after {
39
+ transform: none;
40
+ top: -0.2em;
41
+ }
42
+
43
+ .groups {
44
+ display: grid;
45
+ grid-template-columns: repeat(auto-fill, clamp(225px, 20vw, 350px));
46
+ gap: 30px;
47
+ }
48
+
49
+ .group h2 {
50
+ color: var(--body-quiet-color);
51
+ }
52
+
53
+ #quickpanel {
54
+ display: none;
55
+ line-height: normal;
56
+ flex-basis: 100%;
57
+ align-self: stretch;
58
+ }
59
+
60
+ .qp-open #quickpanel {
61
+ display: block;
62
+ }
63
+
64
+ #quickpanel .group h2 {
65
+ color: var(--body-bg);
66
+ }
67
+
68
+ #quickpanel .module {
69
+ background: inherit;
70
+ color: var(--body-bg);
71
+ }
72
+
73
+ #quickpanel a {
74
+ color: var(--secondary) !important;
75
+ }
76
+
77
+ #quickpanel a.section {
78
+ color: var(--body-bg) !important;
79
+ }
80
+
81
+ @media (prefers-color-scheme: dark) {
82
+ #quickpanel .group h2,
83
+ #quickpanel a,
84
+ #quickpanel a.section {
85
+ color: var(--body-fg) !important;
86
+ }
87
+ }
88
+
89
+ #quickpanel th,
90
+ #quickpanel td {
91
+ border-color: var(--border-color);
92
+ }
93
+
94
+ #quickpanel .module table th {
95
+ width: 100%;
96
+ }
97
+
98
+ #quickpanel tr:last-child td,
99
+ #quickpanel tr:last-child th {
100
+ border-bottom: none;
101
+ }
102
+
103
+ #quickpanel caption {
104
+ background: var(--breadcrumbs-bg);
105
+ }
106
+
107
+ .groups a.addlink {
108
+ position: relative;
109
+ right: -4px;
110
+ }
@@ -0,0 +1,15 @@
1
+ document.addEventListener("DOMContentLoaded", () => {
2
+ for (const el of document.querySelectorAll(".groups a.addlink")) {
3
+ el.innerText = ""
4
+ }
5
+
6
+ const quickpanel = document.getElementById("quickpanel")
7
+ const header = document.querySelector("#header h1")
8
+ if (quickpanel && header) {
9
+ document.body.classList.add("qp-active")
10
+ header.addEventListener("click", (e) => {
11
+ e.preventDefault()
12
+ document.body.classList.toggle("qp-open")
13
+ })
14
+ }
15
+ })
@@ -0,0 +1,17 @@
1
+ {% extends "admin/base_site.html" %}
2
+ {% load i18n static %}
3
+
4
+ {% block extrahead %}{{ block.super }}
5
+ <link rel="stylesheet" href="{% static 'fhadmin/fhadmin.css' %}" />
6
+ <script src="{% static 'fhadmin/fhadmin.js' %}"></script>
7
+ {% endblock %}
8
+
9
+ {% block branding %}
10
+ <h1 id="site-name">{{ site_header|default:_('Django administration') }}</h1>
11
+ {% endblock %}
12
+
13
+ {% block nav-global %}
14
+ <div id="quickpanel">
15
+ {% include "admin/group_list.html" %}
16
+ </div>
17
+ {% endblock %}
@@ -0,0 +1,12 @@
1
+ {% load fhadmin_groups i18n %}
2
+ {% fhadmin_group_list request as group_list %}
3
+ {% for group, app_list in group_list %}
4
+ {% if forloop.first %}<div class="groups">{% endif %}
5
+ <div class="group">
6
+ <h2>{{ group }}</h2>
7
+ {% include 'admin/app_list.html' with show_changelinks=False %}
8
+ </div>
9
+ {% if forloop.last %}</div>{% endif %}
10
+ {% empty %}
11
+ <p>{% translate 'You don’t have permission to view or edit anything.' %}</p>
12
+ {% endfor %}
@@ -0,0 +1,7 @@
1
+ {% extends "admin/index.html" %}
2
+
3
+ {% block content %}
4
+ <div id="content-main">
5
+ {% include "admin/group_list.html" with apply_app_label_filtering=True %}
6
+ </div>
7
+ {% endblock %}
File without changes
@@ -0,0 +1,110 @@
1
+ import operator
2
+ from functools import reduce
3
+
4
+ from django import template
5
+ from django.conf import settings
6
+ from django.contrib import admin
7
+ from django.core.exceptions import ImproperlyConfigured
8
+ from django.utils.translation import gettext_lazy as _
9
+
10
+ from fhadmin import FHADMIN_GROUPS_REMAINING
11
+
12
+
13
+ register = template.Library()
14
+
15
+
16
+ FHADMIN_GROUPS_DEFAULT = [
17
+ (
18
+ _("Main content"),
19
+ (
20
+ "page",
21
+ "medialibrary",
22
+ "elephantblog",
23
+ "pages",
24
+ "articles",
25
+ "cabinet",
26
+ ),
27
+ ),
28
+ (
29
+ _("Modules"),
30
+ (
31
+ "gallery",
32
+ "agenda",
33
+ "links",
34
+ FHADMIN_GROUPS_REMAINING,
35
+ ),
36
+ ),
37
+ (
38
+ _("Preferences"),
39
+ (
40
+ "auth",
41
+ "little_auth",
42
+ "accounts",
43
+ "admin_sso",
44
+ "sites",
45
+ "pinging",
46
+ "feincms3_cookiecontrol",
47
+ "feincms3_sites",
48
+ "simple_redirects",
49
+ ),
50
+ ),
51
+ (
52
+ _("Collections"),
53
+ (
54
+ "external",
55
+ "sharing",
56
+ "newsletter",
57
+ "form_designer",
58
+ ),
59
+ ),
60
+ ]
61
+
62
+
63
+ def generate_group_list(admin_site, request, *, only_app_label=None):
64
+ app_dict = {a["app_label"]: a for a in admin_site.get_app_list(request)}
65
+
66
+ if merge := getattr(settings, "FHADMIN_MERGE", {}):
67
+ for app_label, merge_into in merge.items():
68
+ if app_label in app_dict and merge_into in app_dict:
69
+ app_dict[merge_into]["models"] = sorted(
70
+ app_dict[merge_into]["models"] + app_dict.pop(app_label)["models"],
71
+ key=lambda row: row["name"],
72
+ )
73
+
74
+ if only_app_label is not None:
75
+ for key in list(app_dict):
76
+ if key != only_app_label:
77
+ app_dict.pop(key)
78
+
79
+ fhadmin_groups = getattr(settings, "FHADMIN_GROUPS", FHADMIN_GROUPS_DEFAULT)
80
+ all_configured = reduce(
81
+ operator.or_, (set(apps) for title, apps in fhadmin_groups), set()
82
+ )
83
+
84
+ seen_remaining = False
85
+ for title, apps in fhadmin_groups:
86
+ group_apps = []
87
+ for app in apps:
88
+ if app == FHADMIN_GROUPS_REMAINING:
89
+ group_apps.extend(
90
+ a for a in app_dict.values() if a["app_label"] not in all_configured
91
+ )
92
+ seen_remaining = True
93
+ elif app in app_dict:
94
+ group_apps.append(app_dict[app])
95
+
96
+ if group_apps:
97
+ yield title, group_apps
98
+
99
+ if not seen_remaining:
100
+ raise ImproperlyConfigured(
101
+ "Your FHADMIN_GROUPS override is missing FHADMIN_GROUPS_REMAINING."
102
+ )
103
+
104
+
105
+ @register.simple_tag(takes_context=True)
106
+ def fhadmin_group_list(context, request):
107
+ only_app_label = None
108
+ if context.get("apply_app_label_filtering"):
109
+ only_app_label = context.get("app_label")
110
+ return generate_group_list(admin.sites.site, request, only_app_label=only_app_label)