Skip to content

Commit 29cfb3f

Browse files
authored
Merge pull request #16 from farridav/trodriguez/upgrade_to_adminlte3
Upgrade to adminlte3
2 parents 945ad5a + 12a2196 commit 29cfb3f

File tree

409 files changed

+75360
-71833
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

409 files changed

+75360
-71833
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
/test-reports
1111
__pycache__
1212
_resource
13+
admin_templates
14+
*.sqlite3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ JAZZMIN_SETTINGS = {
3535
'site_header': 'Django',
3636

3737
# square logo to use for your site, must be present in static files, used for favicon and brand on top left
38-
'site_logo': 'admin/dist/img/default-log.svg',
38+
'site_logo': 'jazzmin/img/default-log.svg',
3939

4040
# Welcome text on the login screen
4141
'welcome_sign': 'Welcome',

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Setup & configuration
3838
'site_header': 'Django',
3939

4040
# square logo to use for your site, must be present in static files, used for favicon and brand on top left
41-
'site_logo': 'admin/dist/img/default-log.svg',
41+
'site_logo': 'jazzmin/img/default-log.svg',
4242

4343
# Welcome text on the login screen
4444
'welcome_sign': 'Welcome',

dev-requirements.txt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
-e .
22

3-
wheel
4-
setuptools
5-
twine
6-
flake8
7-
pytest
8-
pytest-django
9-
tox-gh-actions
10-
coverage
11-
tox
12-
tox-pyenv
3+
wheel # python packaging support
4+
setuptools # python packaging support
5+
twine # python packaging tools
6+
flake8 # Static code checking
7+
pytest # Test runner
8+
pytest-django # Django integration for pytest
9+
tox-gh-actions # Github actions support for tox
10+
coverage # Measure code coverage durign tests
11+
tox # Test runner for python packages
12+
tox-pyenv # pyenv support for tox
13+
django-debug-toolbar # unparallelled debugging in django
14+
werkzeug # support for werkzeug debugger in runserver_plus
15+
ipython # enhanced python shell
16+
ipdb # ipython breakpoints
17+
django-extensions # Django Sugar for development
18+
faker # less fake fake data

docs/dashboard.png

66.2 KB
Loading

docs/detail_view.png

68.8 KB
Loading

docs/list_view.png

126 KB
Loading

docs/login.png

29.3 KB
Loading

jazzmin/compat.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,4 @@
1-
import logging
2-
3-
from django.contrib import admin
4-
51
try:
62
from django.urls import reverse, resolve, NoReverseMatch # NOQA
73
except ImportError:
84
from django.core.urlresolvers import reverse, resolve, NoReverseMatch # NOQA
9-
10-
logger = logging.getLogger(__name__)
11-
12-
13-
def get_available_apps(context):
14-
# Django 1.9+
15-
available_apps = context.get('available_apps', [])
16-
request = context.get('request')
17-
18-
if not available_apps:
19-
20-
# Django 1.8 on app index only
21-
available_apps = context.get('app_list')
22-
23-
# Django 1.8 on rest of the pages
24-
if not available_apps and request:
25-
template_response = admin.site(request.current_app).index(request)
26-
available_apps = template_response.context_data['app_list']
27-
28-
if not available_apps:
29-
logger.warning('Unable to retrieve apps list for menu.')
30-
31-
return available_apps

jazzmin/settings.py

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from django.conf import settings
44
from django.contrib.admin import AdminSite
55

6-
from .utils import get_admin_url
6+
from .utils import get_admin_url, get_custom_url, get_model_meta, get_app_admin_urls
77

88
DEFAULT_SETTINGS = {
99
# Choose from black, black-light, blue, blue-light, green, green-light, purple, purple-light
@@ -17,38 +17,44 @@
1717
'site_header': AdminSite.site_header,
1818

1919
# square logo to use for your site, must be present in static files, used for favicon and brand on top left
20-
'site_logo': 'admin/dist/img/default-log.svg',
20+
'site_logo': 'adminlte/img/AdminLTELogo.png',
2121

2222
# Welcome text on the login screen
23-
'welcome_sign': 'Welcome big dog',
23+
'welcome_sign': 'Welcome',
2424

2525
# Copyright on the footer
26-
'copyright': 'Acme Ltd',
27-
28-
# Whether to aut expand the menu
29-
'navigation_expanded': True,
26+
'copyright': '',
3027

3128
# The model admin to search from the search bar, search bar omitted if excluded
32-
'search_model': 'profiles.Profile',
29+
'search_model': None,
3330

3431
# Field name on user model that contains avatar image
3532
'user_avatar': 'avatar',
3633

37-
# Hide these apps when generating menu
34+
# Links to put along the top menu
35+
'topmenu_links': [],
36+
37+
#############
38+
# Side Menu #
39+
#############
40+
41+
# Whether to display the side menu
42+
'show_sidebar': True,
43+
44+
# Whether to aut expand the menu
45+
'navigation_expanded': True,
46+
47+
# Hide these apps when generating side menu
3848
'hide_apps': [],
3949

40-
# Hide these models when generating menu
50+
# Hide these models when generating side menu
4151
'hide_models': [],
4252

43-
# List of apps to base menu ordering off of
44-
'order_with_respect_to': ['profiles', 'devices'],
53+
# List of apps to base side menu ordering off of
54+
'order_with_respect_to': [],
4555

4656
# Custom links to append to app groups, keyed on app name
47-
'custom_links': {
48-
'profiles': [
49-
{'name': 'Custom link', 'url': '/', 'icon': 'fa-user', 'permissions': []}
50-
]
51-
},
57+
'custom_links': {},
5258

5359
# Custom icons per app or model
5460
'icons': {
@@ -60,13 +66,23 @@
6066

6167
def get_settings():
6268
jazzmin_settings = copy.deepcopy(DEFAULT_SETTINGS)
63-
user_settings = getattr(settings, 'JAZZMIN_SETTINGS', {})
69+
user_settings = {x: y for x, y in getattr(settings, 'JAZZMIN_SETTINGS', {}).items() if y is not None}
6470
jazzmin_settings.update(user_settings)
6571

6672
if jazzmin_settings['search_model']:
6773
jazzmin_settings['search_url'] = get_admin_url(jazzmin_settings['search_model'].lower())
6874
jazzmin_settings['search_name'] = jazzmin_settings['search_model'].split('.')[-1] + 's'
6975

76+
for link in jazzmin_settings.get('topmenu_links', []):
77+
if 'url' in link:
78+
link['url'] = get_custom_url(link['url'])
79+
elif 'model' in link:
80+
link['name'] = get_model_meta(link['model']).verbose_name_plural.title()
81+
link['url'] = get_admin_url(link['model'])
82+
elif 'app' in link:
83+
link['name'] = link['app'].title()
84+
link['app_children'] = get_app_admin_urls(link['app'])
85+
7086
jazzmin_settings['hide_apps'] = [x.lower() for x in jazzmin_settings['hide_apps']]
7187
jazzmin_settings['hide_models'] = [x.lower() for x in jazzmin_settings['hide_models']]
7288

0 commit comments

Comments
 (0)