Compare commits

...

8 Commits

Author SHA1 Message Date
Fabio Caccamo c3cf8e4d10 Updated version 2017-05-11 16:55:32 +02:00
Fabio Caccamo a6ae4230f6 Improved scripts and styles order 2017-05-11 16:54:43 +02:00
Fabio Caccamo 07dc59747d Changed static files template tag 2017-05-11 16:54:14 +02:00
Fabio Caccamo 690d28dd8c Improved admin title generation 2017-05-11 16:53:19 +02:00
Fabio Caccamo 8db8528542 Fixed magnific-popup initialization error in admin pages without jquery 2017-05-11 16:52:34 +02:00
Fabio Caccamo cfac48db5d Enforced default theme logo creation 2017-05-11 12:07:35 +02:00
Fabio Caccamo f20d64c99f Updated README [ci skip] 2017-05-04 18:59:38 +02:00
Fabio Caccamo 4cf01aa1df Updated README [ci skip] 2017-05-04 18:52:03 +02:00
5 changed files with 40 additions and 34 deletions
+15 -2
View File
@@ -7,7 +7,13 @@
# django-admin-interface # django-admin-interface
django-admin-interface is a modern **responsive flat admin interface customizable by the admin itself**. django-admin-interface is a modern **responsive flat admin interface customizable by the admin itself**.
You can use the builtin **django-theme** or create your own and **customize** **title, logo and colors**. ## Features
- Beautiful default **django-theme**
- Themes management and customization *(you can **customize admin title, logo and colors**)*
- Responsive
- List filter dropdown *(optional)*
- **`NEW`** **Related modal** *(instead of the old popup window, optional)*
- Style optimizations for: `django-ckeditor`, `django-modeltranslation`, `sorl-thumbnail`
## Requirements ## Requirements
- Python 2.7, 3.4, 3.5, 3.6 - Python 2.7, 3.4, 3.5, 3.6
@@ -28,10 +34,17 @@ INSTALLED_APPS = (
#... #...
) )
``` ```
- Run ``python manage.py migrate`` *(add ``--fake-initial`` if you are upgrading from 0.1.0 version)* - Run ``python manage.py migrate``
- Run ``python manage.py collectstatic`` - Run ``python manage.py collectstatic``
- Restart your application server - Restart your application server
#### Upgrade
- Run `pip install django-admin-interface --upgrade`
- Run ``python manage.py migrate`` *(add ``--fake-initial`` if you are upgrading from 0.1.0 version)*
- Run ``python manage.py collectstatic --clear``
- Restart your application server
## Screenshots ## Screenshots
###### Admin login ###### Admin login
![django-admin-interface_login](https://cloud.githubusercontent.com/assets/1035294/11240233/55c8d4ba-8df1-11e5-9568-00fdc987ede8.gif) ![django-admin-interface_login](https://cloud.githubusercontent.com/assets/1035294/11240233/55c8d4ba-8df1-11e5-9568-00fdc987ede8.gif)
+7 -3
View File
@@ -35,8 +35,7 @@ class Theme(models.Model):
if not default_obj_created and default_obj_active: if not default_obj_created and default_obj_active:
default_obj.set_active() default_obj.set_active()
if not default_obj.logo: default_obj.set_default_logo()
default_obj.set_default_logo()
obj = objs_active_qs.last() obj = objs_active_qs.last()
objs_active_count = objs_active_qs.count() objs_active_count = objs_active_qs.count()
@@ -46,7 +45,6 @@ class Theme(models.Model):
return obj return obj
name = models.CharField( max_length = 50, default = 'Django' ) name = models.CharField( max_length = 50, default = 'Django' )
active = models.BooleanField( default = True ) active = models.BooleanField( default = True )
@@ -109,12 +107,18 @@ class Theme(models.Model):
def set_default_logo(self): def set_default_logo(self):
if self.logo and os.path.isfile(self.logo.url):
return
logo_filename = 'logo-django.svg' logo_filename = 'logo-django.svg'
logo_path = os.path.normpath(os.path.dirname(__file__) + '/data/' + logo_filename) logo_path = os.path.normpath(os.path.dirname(__file__) + '/data/' + logo_filename)
logo_file = open(logo_path) logo_file = open(logo_path)
self.logo = File(logo_file, logo_filename) self.logo = File(logo_file, logo_filename)
post_save.disconnect(Theme.post_save_handler, sender = Theme)
self.save() self.save()
post_save.connect(Theme.post_save_handler, sender = Theme)
logo_file.close() logo_file.close()
@@ -13,7 +13,10 @@
factory(django.jQuery); factory(django.jQuery);
} else { } else {
// Browser globals // Browser globals
factory(window.jQuery || window.Zepto); var $ = (window.jQuery || window.Zepto);
if( $ ){
factory($);
}
} }
}(function ($) { }(function ($) {
+12 -26
View File
@@ -1,9 +1,9 @@
{% extends "admin/base.html" %} {% extends 'admin/base.html' %}
{% load i18n staticfiles admin_interface_tags %} {% load i18n static admin_interface_tags %}
{% block title %} {% block title %}
{% get_admin_interface_theme as theme %} {% get_admin_interface_theme as theme %}
{% if theme.title %}{% trans theme.title %}{% else %}{% trans 'Django administration' %}{% endif %} {% if title %}{{ title }} | {% endif %}{% if theme.title %}{% trans theme.title %}{% else %}{{ site_title|default:_('Django administration') }}{% endif %}
{% endblock %} {% endblock %}
{% block extrastyle %} {% block extrastyle %}
@@ -597,15 +597,21 @@
</style> </style>
{% endblock %} {% endblock %}
{% block extrahead %} {% block blockbots %}
{{ block.super }} {{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive.css" %}" /> {# https://github.com/elky/django-flat-responsive#important-note #}
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive.css' %}" />
{% get_admin_interface_theme as theme %} {% get_admin_interface_theme as theme %}
{% if theme.related_modal_active %} {% if theme.related_modal_active %}
<link rel="stylesheet" type="text/css" href="{% static "admin_interface/magnific-popup/magnific-popup.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static 'admin_interface/magnific-popup/magnific-popup.css' %}" />
<script type="text/javascript" src="{% static 'admin_interface/magnific-popup/jquery.magnific-popup.js' %}"></script>
<script type="text/javascript" src="{% static 'admin_interface/related-modal/related-modal.js' %}"></script>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block bodyclass %}admin-interface flat-theme {% get_admin_interface_theme as theme %}{% if theme.name %}{{ theme.name|slugify }}-theme{% endif %}{% endblock %}
{% block branding %} {% block branding %}
{% get_admin_interface_theme as theme %} {% get_admin_interface_theme as theme %}
<h1 id="site-name"> <h1 id="site-name">
@@ -617,23 +623,3 @@
{% endif %} {% endif %}
</h1> </h1>
{% endblock %} {% endblock %}
{% block bodyclass %}admin-interface flat-theme{% endblock %}
{% block blockbots %}
{{ block.super }}
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
{% endblock %}
{% block sidebar %}
{% endblock %}
{% block footer %}
{{ block.super }}
{% get_admin_interface_theme as theme %}
{% if theme.related_modal_active %}
<script type="text/javascript" src="{% static "admin_interface/magnific-popup/jquery.magnific-popup.js" %}"></script>
<script type="text/javascript" src="{% static "admin_interface/related-modal/related-modal.js" %}"></script>
{% endif %}
{% endblock %}
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__version__ = '0.4.0' __version__ = '0.4.1'