Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7137cbab08 | |||
| 3f7b1e54e9 | |||
| cf76fd412e | |||
| ab0afff087 | |||
| e3811e2609 | |||
| 47a3d66d5c | |||
| 2700b4ff12 | |||
| 6a1897b95c | |||
| e5768da21b | |||
| dc8efcbd6b | |||
| 01c4ad1f06 | |||
| 4a848948a0 | |||
| a96a70400f | |||
| cc0d2a402b | |||
| 415de9ca66 | |||
| 7e57885988 | |||
| 013dcedd37 | |||
| b011256370 | |||
| 752ccbb603 | |||
| 8612012783 | |||
| f78167b711 | |||
| ef9b7e6d1b | |||
| 748b95854e | |||
| 2f10c88375 | |||
| 73c9a54d94 | |||
| eff414b40c | |||
| ccbf76dc5a | |||
| 5b6e83751b | |||
| 572294f646 | |||
| 4e18d36c79 | |||
| ee9994231b | |||
| fb4cfdb772 | |||
| 8535232598 | |||
| abbb666eae | |||
| d48fc882f1 | |||
| f968bd9ffa | |||
| c0592276de |
+2
-1
@@ -1 +1,2 @@
|
|||||||
admin_interface/static/ckeditor/* linguist-vendored
|
admin_interface/static/admin_interface/magnific-popup/* linguist-vendored=true
|
||||||
|
admin_interface/static/ckeditor/* linguist-vendored=true
|
||||||
|
|||||||
+48
-21
@@ -1,33 +1,60 @@
|
|||||||
language: python
|
language: python
|
||||||
python: 3.5
|
python: 3.5
|
||||||
env:
|
env:
|
||||||
- TOX_ENV=py27-17
|
- TOX_ENV=py27-dj17
|
||||||
- TOX_ENV=py27-18
|
- TOX_ENV=py27-dj18
|
||||||
- TOX_ENV=py27-19
|
- TOX_ENV=py27-dj19
|
||||||
- TOX_ENV=py27-110
|
- TOX_ENV=py27-dj110
|
||||||
- TOX_ENV=py34-17
|
- TOX_ENV=py27-dj111
|
||||||
- TOX_ENV=py34-18
|
- TOX_ENV=py34-dj17
|
||||||
- TOX_ENV=py34-19
|
- TOX_ENV=py34-dj18
|
||||||
- TOX_ENV=py34-110
|
- TOX_ENV=py34-dj19
|
||||||
- TOX_ENV=py34-20
|
- TOX_ENV=py34-dj110
|
||||||
- TOX_ENV=py34-master
|
- TOX_ENV=py34-dj111
|
||||||
- TOX_ENV=py35-18
|
- TOX_ENV=py34-dj20
|
||||||
- TOX_ENV=py35-19
|
- TOX_ENV=py35-dj18
|
||||||
- TOX_ENV=py35-110
|
- TOX_ENV=py35-dj19
|
||||||
- TOX_ENV=py35-20
|
- TOX_ENV=py35-dj110
|
||||||
- TOX_ENV=py35-master
|
- TOX_ENV=py35-dj111
|
||||||
|
- TOX_ENV=py35-dj20
|
||||||
|
- TOX_ENV=py35-dj21
|
||||||
|
- TOX_ENV=py35-djmaster
|
||||||
|
# - TOX_ENV=py36-dj111
|
||||||
|
# - TOX_ENV=py36-dj20
|
||||||
|
# - TOX_ENV=py36-dj21
|
||||||
|
# - TOX_ENV=py36-djmaster
|
||||||
|
# - TOX_ENV=py37-dj20
|
||||||
|
# - TOX_ENV=py37-dj21
|
||||||
|
# - TOX_ENV=py37-djmaster
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- python: "3.6"
|
- python: "3.6"
|
||||||
env: TOX_ENV=py36-111
|
env: TOX_ENV=py36-dj111
|
||||||
- python: "3.6"
|
- python: "3.6"
|
||||||
env: TOX_ENV=py36-20
|
env: TOX_ENV=py36-dj20
|
||||||
- python: "3.6"
|
- python: "3.6"
|
||||||
env: TOX_ENV=py36-master
|
env: TOX_ENV=py36-dj21
|
||||||
|
- python: "3.6"
|
||||||
|
env: TOX_ENV=py36-djmaster
|
||||||
|
- python: "3.7"
|
||||||
|
env: TOX_ENV=py37-dj20
|
||||||
|
dist: xenial
|
||||||
|
language: python
|
||||||
|
sudo: required
|
||||||
|
- python: "3.7"
|
||||||
|
env: TOX_ENV=py37-dj21
|
||||||
|
dist: xenial
|
||||||
|
language: python
|
||||||
|
sudo: required
|
||||||
|
- python: "3.7"
|
||||||
|
env: TOX_ENV=py37-djmaster
|
||||||
|
dist: xenial
|
||||||
|
language: python
|
||||||
|
sudo: required
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- env: TOX_ENV=py34-master
|
- env: TOX_ENV=py35-djmaster
|
||||||
- env: TOX_ENV=py35-master
|
- env: TOX_ENV=py36-djmaster
|
||||||
- env: TOX_ENV=py36-master
|
- env: TOX_ENV=py37-djmaster
|
||||||
install:
|
install:
|
||||||
- pip install tox
|
- pip install tox
|
||||||
script:
|
script:
|
||||||
|
|||||||
@@ -8,17 +8,24 @@
|
|||||||
# 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**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Beautiful default **django-theme**
|
- Beautiful default **django-theme**
|
||||||
- Themes management and customization *(you can **customize admin title, logo and colors**)*
|
- Themes management and customization *(you can **customize admin title, logo and colors**)*
|
||||||
- Responsive
|
- Responsive
|
||||||
- List filter dropdown *(optional)*
|
- List filter dropdown *(optional)*
|
||||||
- `NEW` **Related modal** *(instead of the old popup window, optional)*
|
- `NEW` **Related modal** *(instead of the old popup window, optional)*
|
||||||
- Style optimizations for: `django-ckeditor`, `django-modeltranslation`, `sorl-thumbnail`
|
- `NEW` **Enviroment label** *(development, testing, staging, production)*
|
||||||
|
- Style optimizations for:
|
||||||
|
- `django-ckeditor`
|
||||||
|
- `django-modeltranslation`
|
||||||
|
- `django-tabbed-admin`
|
||||||
|
- `sorl-thumbnail`
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
- Python 2.7, 3.4, 3.5, 3.6
|
- Python 2.7, 3.4, 3.5, 3.6, 3.7
|
||||||
- Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0
|
- Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
- Run `pip install django-admin-interface`
|
- Run `pip install django-admin-interface`
|
||||||
@@ -93,4 +100,4 @@ You can use [django-apptemplates](https://github.com/bittner/django-apptemplates
|
|||||||
---
|
---
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Released under [MIT License](LICENSE).
|
Released under [MIT License](LICENSE.txt).
|
||||||
|
|||||||
+13
-3
@@ -6,6 +6,9 @@ django-admin-interface
|
|||||||
django-admin-interface is a modern **responsive flat admin interface
|
django-admin-interface is a modern **responsive flat admin interface
|
||||||
customizable by the admin itself**.
|
customizable by the admin itself**.
|
||||||
|
|
||||||
|
|django-admin-interface_preview|
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@@ -14,13 +17,18 @@ Features
|
|||||||
- Responsive
|
- Responsive
|
||||||
- List filter dropdown *(optional)*
|
- List filter dropdown *(optional)*
|
||||||
- ``NEW`` **Related modal** (instead of the old popup window, optional)
|
- ``NEW`` **Related modal** (instead of the old popup window, optional)
|
||||||
- Style optimizations for: ``django-ckeditor``, ``django-modeltranslation``, ``sorl-thumbnail``
|
- ``NEW`` **Enviroment label** (development, testing, staging, production)
|
||||||
|
- Style optimizations for:
|
||||||
|
- `django-ckeditor`
|
||||||
|
- `django-modeltranslation`
|
||||||
|
- `django-tabbed-admin`
|
||||||
|
- `sorl-thumbnail`
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
- Python 2.7, 3.4, 3.5, 3.6
|
- Python 2.7, 3.4, 3.5, 3.6, 3.7
|
||||||
- Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0
|
- Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
@@ -133,6 +141,8 @@ Released under **MIT License**.
|
|||||||
|
|
||||||
.. |License| image:: https://img.shields.io/pypi/l/django-admin-interface.svg
|
.. |License| image:: https://img.shields.io/pypi/l/django-admin-interface.svg
|
||||||
|
|
||||||
|
.. |django-admin-interface_preview| image:: https://user-images.githubusercontent.com/1035294/35631521-64b0cab8-06a4-11e8-8f57-c04fdfbb7e8b.gif
|
||||||
|
|
||||||
.. |django-admin-interface_login| image:: https://cloud.githubusercontent.com/assets/1035294/11240233/55c8d4ba-8df1-11e5-9568-00fdc987ede8.gif
|
.. |django-admin-interface_login| image:: https://cloud.githubusercontent.com/assets/1035294/11240233/55c8d4ba-8df1-11e5-9568-00fdc987ede8.gif
|
||||||
|
|
||||||
.. |django-admin-interface_dashboard| image:: https://cloud.githubusercontent.com/assets/1035294/11240239/627c0362-8df1-11e5-81fa-216366a5d8da.gif
|
.. |django-admin-interface_dashboard| image:: https://cloud.githubusercontent.com/assets/1035294/11240239/627c0362-8df1-11e5-81fa-216366a5d8da.gif
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ class AdminInterfaceConfig(AppConfig):
|
|||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
|
|
||||||
|
from admin_interface import settings
|
||||||
from admin_interface.models import Theme
|
from admin_interface.models import Theme
|
||||||
|
|
||||||
|
settings.check_installed_apps()
|
||||||
post_migrate.connect(
|
post_migrate.connect(
|
||||||
Theme.post_migrate_handler, sender=self)
|
Theme.post_migrate_handler, sender=self)
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
"fields": {
|
"fields": {
|
||||||
"name": "USWDS",
|
"name": "USWDS",
|
||||||
"active": true,
|
"active": true,
|
||||||
"title": "Site administration",
|
"title": "Django administration",
|
||||||
"title_color": "#FFFFFF",
|
"title_color": "#FFFFFF",
|
||||||
"title_visible": true,
|
"title_visible": false,
|
||||||
"logo": "",
|
"logo": "",
|
||||||
"logo_color": "#FFFFFF",
|
"logo_color": "#FFFFFF",
|
||||||
"logo_visible": false,
|
"logo_visible": true,
|
||||||
"css_header_background_color": "#112E51",
|
"css_header_background_color": "#112E51",
|
||||||
"css_header_text_color": "#FFFFFF",
|
"css_header_text_color": "#FFFFFF",
|
||||||
"css_header_link_color": "#FFFFFF",
|
"css_header_link_color": "#FFFFFF",
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import django
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
||||||
|
|
||||||
|
def check_installed_apps():
|
||||||
|
dj_version = django.VERSION
|
||||||
|
installed_apps = settings.INSTALLED_APPS
|
||||||
|
|
||||||
|
if 'colorfield' not in installed_apps:
|
||||||
|
raise ImproperlyConfigured(
|
||||||
|
'\'colorfield\' needed, '
|
||||||
|
'add it to settings.INSTALLED_APPS.')
|
||||||
|
|
||||||
|
if dj_version < (1, 9):
|
||||||
|
if 'flat' not in installed_apps:
|
||||||
|
raise ImproperlyConfigured(
|
||||||
|
'\'flat\' needed before django 1.9, '
|
||||||
|
'add it to settings.INSTALLED_APPS.')
|
||||||
|
else:
|
||||||
|
if 'flat' in installed_apps:
|
||||||
|
raise ImproperlyConfigured(
|
||||||
|
'\'flat\' not needed since django 1.9, '
|
||||||
|
'remove it from settings.INSTALLED_APPS.')
|
||||||
|
|
||||||
|
if dj_version < (2, 0):
|
||||||
|
if 'flat_responsive' not in installed_apps:
|
||||||
|
raise ImproperlyConfigured(
|
||||||
|
'\'flat_responsive\' needed before django 2.0, '
|
||||||
|
'add it to settings.INSTALLED_APPS.')
|
||||||
|
else:
|
||||||
|
if 'flat_responsive' in installed_apps:
|
||||||
|
raise ImproperlyConfigured(
|
||||||
|
'\'flat_responsive\' not needed since django 2.0, '
|
||||||
|
'remove it from settings.INSTALLED_APPS.')
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
||||||
|
{
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('.cancel-link').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var parentWindow = window.parent;
|
||||||
|
if (parentWindow && typeof(parentWindow.dismissRelatedObjectModal) === 'function') {
|
||||||
|
parentWindow.dismissRelatedObjectModal();
|
||||||
|
} else {
|
||||||
|
// fallback to default behavior
|
||||||
|
history.back();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
})(django.jQuery);
|
||||||
|
}
|
||||||
@@ -1,45 +1,52 @@
|
|||||||
/*global opener */
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
var windowRef = window;
|
|
||||||
var windowName = windowRef.name;
|
function getModalWindowData()
|
||||||
var widgetName = windowName.replace(/^(change|add|delete|lookup)_/, '');
|
{
|
||||||
//var windowNames = windowName.split('____');
|
var windowRef = window;
|
||||||
//var widgetName = windowNames[(windowNames.length - 1)];
|
var windowName = windowRef.name;
|
||||||
//widgetName = widgetName.replace(/^(change|add|delete|lookup)_/, '');
|
var widgetName = windowName.replace(/^(change|add|delete|lookup)_/, '');
|
||||||
//console.log('dismiss modal and update widget with id: "' + widgetName + '"');
|
var modalRef = {};
|
||||||
var modalRef = {};
|
var openerRef = windowRef.opener;
|
||||||
var openerRef = windowRef.opener;
|
if (!openerRef) {
|
||||||
if(!openerRef){
|
openerRef = windowRef.parent;
|
||||||
openerRef = windowRef.parent;
|
modalRef = {
|
||||||
modalRef = {
|
name: openerRef.id_to_windowname(widgetName),
|
||||||
name: openerRef.id_to_windowname(widgetName),
|
close: function(){
|
||||||
close: function(){
|
openerRef.dismissRelatedObjectModal();
|
||||||
openerRef.dismissRelatedObjectModal();
|
}
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
|
return { opener:openerRef, modal:modalRef };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var modalData = getModalWindowData();
|
||||||
|
var modalRef = modalData['modal'];
|
||||||
|
var openerRef = modalData['opener'];
|
||||||
|
|
||||||
var initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);
|
var initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);
|
||||||
switch(initData.action){
|
// console.log(initData);
|
||||||
|
switch (initData.action) {
|
||||||
case 'change':
|
case 'change':
|
||||||
if( typeof(openerRef.dismissChangeRelatedObjectPopup) == 'function' ){
|
if (typeof(openerRef.dismissChangeRelatedObjectPopup) === 'function') {
|
||||||
openerRef.dismissChangeRelatedObjectPopup(modalRef, initData.value, initData.obj, initData.new_value);
|
openerRef.dismissChangeRelatedObjectPopup(modalRef, initData.value, initData.obj, initData.new_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if( typeof(openerRef.dismissDeleteRelatedObjectPopup) == 'function' ){
|
if (typeof(openerRef.dismissDeleteRelatedObjectPopup) === 'function') {
|
||||||
openerRef.dismissDeleteRelatedObjectPopup(modalRef, initData.value);
|
openerRef.dismissDeleteRelatedObjectPopup(modalRef, initData.value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if( typeof(openerRef.dismissAddRelatedObjectPopup) == 'function' ){
|
if (typeof(openerRef.dismissAddRelatedObjectPopup) === 'function') {
|
||||||
openerRef.dismissAddRelatedObjectPopup(modalRef, initData.value, initData.obj);
|
openerRef.dismissAddRelatedObjectPopup(modalRef, initData.value, initData.obj);
|
||||||
}
|
}
|
||||||
else if( typeof(openerRef.dismissAddAnotherPopup) == 'function' ){
|
else if (typeof(openerRef.dismissAddAnotherPopup) === 'function') {
|
||||||
// django 1.7 compatibility
|
// django 1.7 compatibility
|
||||||
openerRef.dismissAddAnotherPopup(modalRef, initData.value, initData.obj);
|
openerRef.dismissAddAnotherPopup(modalRef, initData.value, initData.obj);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -1,23 +1,45 @@
|
|||||||
if(typeof django !== 'undefined' && typeof django.jQuery !== 'undefined' )
|
if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
||||||
{
|
{
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
// create the function that will close the modal
|
function dismissModal()
|
||||||
function dismissRelatedObjectModal()
|
|
||||||
{
|
{
|
||||||
// close the popup as modal
|
|
||||||
$.magnificPopup.close();
|
$.magnificPopup.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign the function to a global variable
|
// create the function that will close the modal
|
||||||
|
function dismissRelatedObjectModal()
|
||||||
|
{
|
||||||
|
dismissModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
function dismissRelatedLookupModal(win, chosenId)
|
||||||
|
{
|
||||||
|
var windowRef = win;
|
||||||
|
var windowName = windowRef.name;
|
||||||
|
var widgetName = windowName.replace(/^(change|add|delete|lookup)_/, '');
|
||||||
|
var widgetEl = $('#' + widgetName);
|
||||||
|
var widgetVal = widgetEl.val();
|
||||||
|
if (widgetEl.hasClass('vManyToManyRawIdAdminField') && Boolean(widgetVal)) {
|
||||||
|
widgetEl.val(widgetVal + ', ' + chosenId);
|
||||||
|
} else {
|
||||||
|
widgetEl.val(chosenId);
|
||||||
|
}
|
||||||
|
dismissModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
// assign functions to global variables
|
||||||
window.dismissRelatedObjectModal = dismissRelatedObjectModal;
|
window.dismissRelatedObjectModal = dismissRelatedObjectModal;
|
||||||
|
window.dismissRelatedLookupPopup = dismissRelatedLookupModal;
|
||||||
|
|
||||||
function presentRelatedObjectModal(e)
|
function presentRelatedObjectModal(e)
|
||||||
{
|
{
|
||||||
var href = ($(this).attr('href') || '');
|
var linkEl = $(this);
|
||||||
if( href == '' ){
|
|
||||||
|
var href = (linkEl.attr('href') || '');
|
||||||
|
if (href == '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,40 +48,57 @@ if(typeof django !== 'undefined' && typeof django.jQuery !== 'undefined' )
|
|||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
// remove focus from clicked link
|
// remove focus from clicked link
|
||||||
$(this).blur();
|
linkEl.blur();
|
||||||
|
|
||||||
// use the clicked link id as iframe name
|
// use the clicked link id as iframe name
|
||||||
// it will be available as window.name in the loaded iframe
|
// it will be available as window.name in the loaded iframe
|
||||||
var iframeName = $(this).attr('id');
|
var iframeName = linkEl.attr('id');
|
||||||
// var iframeName = String(window.name + '____' + $(this).attr('id'));
|
|
||||||
// console.log('open modal with name: "' + iframeName + '"');
|
|
||||||
|
|
||||||
// browsers stop loading nested iframes having the same src url
|
|
||||||
// create a random parameter and append it to the src url to prevent it
|
|
||||||
var iframeSrcRandom = String(Math.round(Math.random() * 999999));
|
|
||||||
var iframeSrc = href;
|
var iframeSrc = href;
|
||||||
|
|
||||||
// fix for django 1.7
|
if (e.data.lookup !== true)
|
||||||
if( iframeSrc.indexOf('_popup=1') == -1 ){
|
{
|
||||||
iframeSrc += '&_popup=1';
|
// browsers stop loading nested iframes having the same src url
|
||||||
|
// create a random parameter and append it to the src url to prevent it
|
||||||
|
// this workaround doesn't work with related lookup url
|
||||||
|
var iframeSrcRandom = String(Math.round(Math.random() * 999999));
|
||||||
|
if( iframeSrc.indexOf('?') === -1 ){
|
||||||
|
iframeSrc += '?_modal=' + iframeSrcRandom;
|
||||||
|
} else {
|
||||||
|
iframeSrc += '&_modal=' + iframeSrcRandom;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iframeSrc += '&_modal=' + iframeSrcRandom;
|
// fix for django 1.7
|
||||||
|
if (iframeSrc.indexOf('_popup=1') === -1) {
|
||||||
|
if (iframeSrc.indexOf('?') === -1) {
|
||||||
|
iframeSrc += '?_popup=1';
|
||||||
|
} else {
|
||||||
|
iframeSrc += '&_popup=1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// build the iframe html
|
// build the iframe html
|
||||||
// var iframeHTML = '<iframe id="related-modal" name="' + iframeName + '" src="' + iframeSrc + '"></iframe>';
|
|
||||||
var iframeHTML = '<iframe id="related-modal-iframe" name="' + iframeName + '" src="' + iframeSrc + '"></iframe>';
|
var iframeHTML = '<iframe id="related-modal-iframe" name="' + iframeName + '" src="' + iframeSrc + '"></iframe>';
|
||||||
|
|
||||||
// create the iframe jquery element
|
// create the iframe jquery element
|
||||||
var iframeEl = $(iframeHTML);
|
var iframeEl = $(iframeHTML);
|
||||||
|
|
||||||
|
if (e.data.lookup === true)
|
||||||
|
{
|
||||||
|
// set current window as iframe opener because
|
||||||
|
// the callback is called on the opener window
|
||||||
|
iframeEl.load(function(){
|
||||||
|
var iframeObj = $(this).get(0);
|
||||||
|
var iframeWindow = iframeObj.contentWindow;
|
||||||
|
iframeWindow.opener = window;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// the modal css class
|
// the modal css class
|
||||||
var iframeInternalModalClass = 'related-modal';
|
var iframeInternalModalClass = 'related-modal';
|
||||||
|
|
||||||
// if the current window is inside an iframe, it means that it is already in a modal,
|
// if the current window is inside an iframe, it means that it is already in a modal,
|
||||||
// append an additional css class to the modal to offer more customization
|
// append an additional css class to the modal to offer more customization
|
||||||
if( window.top != window.self )
|
if (window.top != window.self) {
|
||||||
{
|
|
||||||
iframeInternalModalClass += ' related-modal__nested';
|
iframeInternalModalClass += ' related-modal__nested';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,12 +118,15 @@ if(typeof django !== 'undefined' && typeof django.jQuery !== 'undefined' )
|
|||||||
|
|
||||||
// django 1.7 compatibility
|
// django 1.7 compatibility
|
||||||
$('a.add-another').removeAttr('onclick');
|
$('a.add-another').removeAttr('onclick');
|
||||||
$('a.add-another').click( presentRelatedObjectModal );
|
$('a.add-another').click({ lookup:false }, presentRelatedObjectModal);
|
||||||
|
|
||||||
// django 1.8 and above
|
// django 1.8 and above
|
||||||
$('a.related-widget-wrapper-link').click( presentRelatedObjectModal );
|
$('a.related-widget-wrapper-link').click({ lookup:false }, presentRelatedObjectModal);
|
||||||
|
|
||||||
|
// raw_id_fields support
|
||||||
|
$('a.related-lookup').unbind('click');
|
||||||
|
$('a.related-lookup').click({ lookup:true }, presentRelatedObjectModal);
|
||||||
});
|
});
|
||||||
|
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,10 @@ https://github.com/fabiocaccamo/django-admin-interface
|
|||||||
{% include "admin_interface/css/list-filter-dropdown.css" %}
|
{% include "admin_interface/css/list-filter-dropdown.css" %}
|
||||||
{% include "admin_interface/css/recent-actions.css" %}
|
{% include "admin_interface/css/recent-actions.css" %}
|
||||||
{% include "admin_interface/css/related-modal.css" %}
|
{% include "admin_interface/css/related-modal.css" %}
|
||||||
|
{% include "admin_interface/css/jquery.ui.tabs.css" %}
|
||||||
{% include "admin_interface/css/modeltranslation.css" %}
|
{% include "admin_interface/css/modeltranslation.css" %}
|
||||||
{% include "admin_interface/css/sorl-thumbnail.css" %}
|
{% include "admin_interface/css/sorl-thumbnail.css" %}
|
||||||
|
{% include "admin_interface/css/tabbed-admin.css" %}
|
||||||
{% include "admin_interface/css/ckeditor.css" %}
|
{% include "admin_interface/css/ckeditor.css" %}
|
||||||
{% include "admin_interface/css/tinymce.css" %}
|
{% include "admin_interface/css/tinymce.css" %}
|
||||||
|
|
||||||
|
|||||||
@@ -308,79 +308,28 @@ body.admin-interface .paginator a.showall:visited {
|
|||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
flex: 0 1 auto;
|
flex: 0 1 auto;
|
||||||
}
|
}
|
||||||
|
.admin-interface .aligned .form-row input[type="file"] {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* improve responsive selector */
|
/* improve responsive selector */
|
||||||
|
|
||||||
/* fix [stacked, not-stacked] equalize horizontal and vertical select padding for selector (stacked and not) */
|
/* fix [stacked, not-stacked] equalize horizontal and vertical select padding for selector */
|
||||||
.admin-interface .selector .selector-available select,
|
.admin-interface .selector .selector-available select,
|
||||||
.admin-interface .selector .selector-chosen select {
|
.admin-interface .selector .selector-chosen select {
|
||||||
padding: 7px 10px;
|
padding: 7px 10px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fix [not-stacked] selector */
|
/* fix [stacked, not-stacked] select options text overflow */
|
||||||
.admin-interface .selector:not(.stacked) {
|
.admin-interface .selector .selector-available select option,
|
||||||
width: auto;
|
.admin-interface .selector .selector-chosen select option {
|
||||||
margin-right: 10px;
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fix [not-stacked] equalize selectors height by adding the height of the .selector-available filter-bar */
|
/* fix [not-stacked] equalize selectors height by adding the height of the .selector-available filter-bar */
|
||||||
.admin-interface .selector:not(.stacked) .selector-chosen select {
|
.admin-interface .selector:not(.stacked) .selector-chosen select {
|
||||||
height: calc(46px + 17.2em) !important;
|
height: calc(46px + 17.2em) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1024px){
|
|
||||||
.admin-interface .related-widget-wrapper-link + .selector:not(.stacked) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 767px) and (max-width: 1124px){
|
|
||||||
|
|
||||||
.admin-interface .selector:not(.stacked) .selector-available,
|
|
||||||
.admin-interface .selector:not(.stacked) .selector-chosen {
|
|
||||||
width: 285px;
|
|
||||||
flex: 0 1 auto;
|
|
||||||
}
|
|
||||||
.admin-interface .selector:not(.stacked) .selector-filter {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.admin-interface .selector:not(.stacked) .selector-filter label {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
.admin-interface .selector:not(.stacked) .selector-available input {
|
|
||||||
width: auto;
|
|
||||||
flex: 1 1;
|
|
||||||
}
|
|
||||||
.admin-interface .selector:not(.stacked) select {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fix [not-stacked] in tabular inline context */
|
|
||||||
.admin-interface .tabular.inline-related .selector:not(.stacked) {
|
|
||||||
width: 795px;
|
|
||||||
float: none;
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface .tabular.inline-related .form-row .related-widget-wrapper-link:first-child {
|
|
||||||
float: right;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fix [stacked] in tabular inline context */
|
|
||||||
.admin-interface .tabular.inline-related .selector.stacked {
|
|
||||||
width: 480px;
|
|
||||||
float: none;
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fix [stacked] chooser align center */
|
|
||||||
.admin-interface .selector.stacked .selector-chooser {
|
|
||||||
margin-left:calc(50% - 30px);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* jQuery UI CSS Framework
|
||||||
|
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
|
||||||
|
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
||||||
|
* http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/base/jquery.ui.core.css
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
backward compatibility:
|
||||||
|
.ui-tabs-selected: jquery ui < 1.10
|
||||||
|
.ui-tabs-active classes jquery ui >= 1.10
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Layout helpers
|
||||||
|
----------------------------------*/
|
||||||
|
.ui-helper-hidden { display: none; }
|
||||||
|
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
||||||
|
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
||||||
|
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
||||||
|
.ui-helper-clearfix { display: inline-block; }
|
||||||
|
/* required comment for clearfix to work in Opera \*/
|
||||||
|
* html .ui-helper-clearfix { height:1%; }
|
||||||
|
.ui-helper-clearfix { display:block; }
|
||||||
|
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
||||||
|
.ui-state-disabled { cursor: default !important; }
|
||||||
|
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
||||||
|
/* http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/base/jquery.ui.tabs.css */
|
||||||
|
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||||
|
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
|
||||||
|
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
|
||||||
|
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
|
||||||
|
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
|
||||||
|
.ui-tabs .ui-tabs-nav li.ui-tabs-active, .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
|
||||||
|
.ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
||||||
|
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
||||||
|
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
|
||||||
|
.ui-tabs .ui-tabs-hide {
|
||||||
|
position: absolute;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom tabs theme */
|
||||||
|
.admin-interface .ui-tabs {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .ui-tabs,
|
||||||
|
.admin-interface .ui-tabs .ui-widget-header,
|
||||||
|
.admin-interface .ui-tabs .ui-widget-header .ui-state-default {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-nav {
|
||||||
|
padding: 10px 0 0 10px;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-nav li {
|
||||||
|
margin: 0 0 0 -1px;
|
||||||
|
}
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-nav li.required {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-nav li a {
|
||||||
|
border: 1px solid #eeeeee;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-bottom: none;
|
||||||
|
color: #666666;
|
||||||
|
padding: 7px 14px 8px 14px;
|
||||||
|
margin-top: 1px;
|
||||||
|
-moz-border-radius-topright: 4px;
|
||||||
|
-webkit-border-top-right-radius: 4px;
|
||||||
|
-moz-border-radius-topleft: 4px;
|
||||||
|
-webkit-border-top-left-radius: 4px;
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-nav li.ui-tabs-active a,
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-nav li.ui-tabs-selected a {
|
||||||
|
padding: 8px 14px 8px 14px;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
color: {{ theme.css_module_background_color }};
|
||||||
|
border-bottom: 1px solid #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-panel {
|
||||||
|
border: 1px solid #eeeeee;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .inline-group .tabular .ui-tabs .ui-tabs-panel {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .inline-group .tabular .ui-tabs .ui-tabs-nav {
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .inline-group .tabular tr td {
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .inline-group .tabular tr.has_original td.original,
|
||||||
|
.admin-interface .inline-group .tabular tr td.delete {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .inline-group .tabular .datetime > input {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .inline-group .tabular .datetime br {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface #changelist .row1:not(.selected):hover,
|
||||||
|
.admin-interface #changelist .row2:not(.selected):hover {
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .row2 {
|
||||||
|
background: #fcfcfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .row2 .ui-tabs .ui-tabs-nav li a {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border: 1px solid #ebebeb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .row2 .ui-tabs .ui-tabs-nav li.ui-tabs-active a,
|
||||||
|
.admin-interface .row2 .ui-tabs .ui-tabs-nav li.ui-tabs-selected a {
|
||||||
|
background-color: #fcfcfc;
|
||||||
|
border-bottom: 1px solid #fcfcfc;
|
||||||
|
}
|
||||||
@@ -1,65 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
django-modeltranslation support
|
django-modeltranslation support
|
||||||
https://github.com/deschler/django-modeltranslation/pull/313/commits
|
https://github.com/deschler/django-modeltranslation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.admin-interface #content h1 select {
|
.admin-interface #content h1 select {
|
||||||
text-transform:uppercase;
|
text-transform: uppercase;
|
||||||
margin-left:15px;
|
margin-left: 15px;
|
||||||
|
min-width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-interface .ui-tabs .ui-tabs-nav {
|
.admin-interface .ui-tabs .ui-tabs-panel[id^=tab_id_] {
|
||||||
padding:10px 0 0 10px;
|
border: none;
|
||||||
}
|
border-top: 1px solid #eeeeee;
|
||||||
|
padding: 0;
|
||||||
.admin-interface .ui-tabs .ui-tabs-nav li {
|
margin-bottom: 0;
|
||||||
margin-left:-1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface .ui-tabs .ui-tabs-nav li a {
|
|
||||||
outline:none;
|
|
||||||
background-color:#f8f8f8;
|
|
||||||
border:1px solid #eeeeee;
|
|
||||||
border-bottom:none;
|
|
||||||
text-transform:uppercase;
|
|
||||||
|
|
||||||
padding:7px 14px 8px 14px;
|
|
||||||
margin-top:1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface .ui-tabs .ui-tabs-nav li.ui-tabs-active a,
|
|
||||||
.admin-interface .ui-tabs .ui-tabs-nav li.ui-tabs-selected a {
|
|
||||||
|
|
||||||
padding:8px 14px 8px 14px;
|
|
||||||
margin-top:0px;
|
|
||||||
margin-bottom:-1px;
|
|
||||||
font-weight: bold;
|
|
||||||
background-color:#FFFFFF;
|
|
||||||
color:{{ theme.css_module_background_color }};
|
|
||||||
|
|
||||||
border-bottom:1px solid #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface .inline-group .tabular .ui-tabs .ui-tabs-panel {
|
|
||||||
padding:8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface #changelist .row1:not(.selected):hover,
|
|
||||||
.admin-interface #changelist .row2:not(.selected):hover {
|
|
||||||
background:#f9f9f9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface .row2 {
|
|
||||||
background:#fcfcfc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface .row2 .ui-tabs .ui-tabs-nav li a {
|
|
||||||
background-color:#f5f5f5;
|
|
||||||
border:1px solid #ebebeb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-interface .row2 .ui-tabs .ui-tabs-nav li.ui-tabs-active a,
|
|
||||||
.admin-interface .row2 .ui-tabs .ui-tabs-nav li.ui-tabs-selected a {
|
|
||||||
background-color:#fcfcfc;
|
|
||||||
border-bottom:1px solid #fcfcfc;
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
django-tabbed-admin support
|
||||||
|
https://github.com/omji/django-tabbed-admin
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Hide tabs until ready */
|
||||||
|
/*
|
||||||
|
.admin-interface #tabs ul {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface #tabs ul.ui-tabs-nav {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-panel[id^=tabs] .module.aligned:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-panel[id^=tabs] .module.aligned:last-child .form-row:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 350px){
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-panel[id^=tabs] .vTextField,
|
||||||
|
.admin-interface .inline-related .vTextField {
|
||||||
|
width: 17em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767px){
|
||||||
|
/* fix horizontal overflow - responsive.css:563 */
|
||||||
|
.admin-interface .ui-tabs .ui-tabs-panel[id^=tabs] .aligned .form-row > div:not([class]) {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,20 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from django import template
|
from django import template, VERSION
|
||||||
|
|
||||||
from admin_interface.models import Theme
|
from admin_interface.models import Theme
|
||||||
from admin_interface.version import __version__
|
from admin_interface.version import __version__
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
try:
|
if VERSION < (1, 9):
|
||||||
assignment_tag = register.assignment_tag
|
simple_tag = register.assignment_tag
|
||||||
except AttributeError:
|
else:
|
||||||
assignment_tag = register.simple_tag
|
simple_tag = register.simple_tag
|
||||||
|
|
||||||
|
|
||||||
@assignment_tag(takes_context=True)
|
@simple_tag(takes_context=True)
|
||||||
def get_admin_interface_theme(context):
|
def get_admin_interface_theme(context):
|
||||||
|
|
||||||
theme = None
|
theme = None
|
||||||
request = context.get('request', None)
|
request = context.get('request', None)
|
||||||
|
|
||||||
@@ -31,6 +30,6 @@ def get_admin_interface_theme(context):
|
|||||||
return theme
|
return theme
|
||||||
|
|
||||||
|
|
||||||
@assignment_tag(takes_context=False)
|
@simple_tag(takes_context=False)
|
||||||
def get_admin_interface_version():
|
def get_admin_interface_version():
|
||||||
return __version__
|
return __version__
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__version__ = '0.6.0'
|
__version__ = '0.8.1'
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ setup(
|
|||||||
'Framework :: Django :: 1.10',
|
'Framework :: Django :: 1.10',
|
||||||
'Framework :: Django :: 1.11',
|
'Framework :: Django :: 1.11',
|
||||||
'Framework :: Django :: 2.0',
|
'Framework :: Django :: 2.0',
|
||||||
|
'Framework :: Django :: 2.1',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'License :: OSI Approved :: MIT License',
|
'License :: OSI Approved :: MIT License',
|
||||||
'Natural Language :: English',
|
'Natural Language :: English',
|
||||||
@@ -56,6 +57,7 @@ setup(
|
|||||||
'Programming Language :: Python :: 3.4',
|
'Programming Language :: Python :: 3.4',
|
||||||
'Programming Language :: Python :: 3.5',
|
'Programming Language :: Python :: 3.5',
|
||||||
'Programming Language :: Python :: 3.6',
|
'Programming Language :: Python :: 3.6',
|
||||||
|
'Programming Language :: Python :: 3.7',
|
||||||
'Topic :: Software Development :: Build Tools',
|
'Topic :: Software Development :: Build Tools',
|
||||||
],
|
],
|
||||||
license='MIT',
|
license='MIT',
|
||||||
|
|||||||
+31
-8
@@ -9,24 +9,46 @@ SECRET_KEY = 'django-admin-interface'
|
|||||||
|
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
|
# Application definition
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
|
||||||
'admin_interface',
|
'admin_interface',
|
||||||
'flat_responsive',
|
|
||||||
'flat', #if django version < 1.9
|
|
||||||
'colorfield',
|
'colorfield',
|
||||||
|
]
|
||||||
|
|
||||||
|
if django.VERSION < (1, 9):
|
||||||
|
# ONLY if django version < 1.9
|
||||||
|
INSTALLED_APPS += [
|
||||||
|
'flat',
|
||||||
|
]
|
||||||
|
|
||||||
|
if django.VERSION < (2, 0):
|
||||||
|
# ONLY if django version < 2.0
|
||||||
|
INSTALLED_APPS += [
|
||||||
|
'flat_responsive',
|
||||||
|
]
|
||||||
|
|
||||||
|
INSTALLED_APPS += [
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.messages',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = [
|
if django.VERSION < (2, 0):
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
MIDDLEWARE_CLASSES = [
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware'
|
||||||
]
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
TEMPLATES = [{
|
TEMPLATES = [{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
@@ -35,6 +57,7 @@ TEMPLATES = [{
|
|||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
},]
|
},]
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import django
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from django.test import override_settings, TestCase
|
||||||
|
|
||||||
|
from admin_interface.settings import check_installed_apps
|
||||||
|
|
||||||
|
|
||||||
|
class AdminInterfaceSettingsTestCase(TestCase):
|
||||||
|
|
||||||
|
DJANGO_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
]
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __test_installed_apps(self):
|
||||||
|
dj_version = django.VERSION
|
||||||
|
installed_apps = settings.INSTALLED_APPS
|
||||||
|
|
||||||
|
if 'colorfield' not in installed_apps:
|
||||||
|
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
||||||
|
|
||||||
|
elif 'flat' not in installed_apps and dj_version < (1, 9):
|
||||||
|
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
||||||
|
|
||||||
|
elif 'flat' in installed_apps and dj_version >= (1, 9):
|
||||||
|
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
||||||
|
|
||||||
|
elif 'flat_responsive' not in installed_apps and dj_version < (2, 0):
|
||||||
|
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
||||||
|
|
||||||
|
elif 'flat_responsive' in installed_apps and dj_version >= (2, 0):
|
||||||
|
self.assertRaises(ImproperlyConfigured, check_installed_apps)
|
||||||
|
|
||||||
|
else:
|
||||||
|
check_installed_apps()
|
||||||
|
|
||||||
|
@override_settings(
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'admin_interface',
|
||||||
|
'colorfield',
|
||||||
|
'flat',
|
||||||
|
'flat_responsive',
|
||||||
|
] + DJANGO_APPS
|
||||||
|
)
|
||||||
|
def test_installed_apps_all(self):
|
||||||
|
self.__test_installed_apps()
|
||||||
|
|
||||||
|
@override_settings(
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'admin_interface',
|
||||||
|
# 'colorfield',
|
||||||
|
'flat',
|
||||||
|
'flat_responsive',
|
||||||
|
] + DJANGO_APPS
|
||||||
|
)
|
||||||
|
def test_installed_apps_no_colorfield(self):
|
||||||
|
self.__test_installed_apps()
|
||||||
|
|
||||||
|
@override_settings(
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'admin_interface',
|
||||||
|
'colorfield',
|
||||||
|
# 'flat',
|
||||||
|
'flat_responsive',
|
||||||
|
] + DJANGO_APPS
|
||||||
|
)
|
||||||
|
def test_installed_apps_no_flat(self):
|
||||||
|
self.__test_installed_apps()
|
||||||
|
|
||||||
|
@override_settings(
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'admin_interface',
|
||||||
|
'colorfield',
|
||||||
|
'flat',
|
||||||
|
# 'flat_responsive',
|
||||||
|
] + DJANGO_APPS
|
||||||
|
)
|
||||||
|
def test_installed_apps_no_flat_responsive(self):
|
||||||
|
self.__test_installed_apps()
|
||||||
|
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist =
|
envlist =
|
||||||
py27-{17,18,19,110,111},
|
py27-{dj17,dj18,dj19,dj110,dj111},
|
||||||
py34-{17,18,19,110,111,20,master},
|
py34-{dj17,dj18,dj19,dj110,dj111,dj20},
|
||||||
py35-{18,19,110,111,20,master},
|
py35-{dj18,dj19,dj110,dj111,dj20,dj21,djmaster},
|
||||||
py36-{18,19,110,111,20,master},
|
py36-{dj18,dj19,dj110,dj111,dj20,dj21,djmaster},
|
||||||
|
py37-{dj20,dj21,djmaster},
|
||||||
[testenv]
|
[testenv]
|
||||||
passenv = CI TRAVIS TRAVIS_*
|
passenv = CI TRAVIS TRAVIS_*
|
||||||
deps =
|
deps =
|
||||||
17: Django >= 1.7, < 1.8
|
dj17: Django >= 1.7, < 1.8
|
||||||
18: Django >= 1.8, < 1.9
|
dj18: Django >= 1.8, < 1.9
|
||||||
19: Django >= 1.9, < 1.10
|
dj19: Django >= 1.9, < 1.10
|
||||||
110: Django >= 1.10, < 1.11
|
dj110: Django >= 1.10, < 1.11
|
||||||
111: Django >= 1.11, < 1.12
|
dj111: Django >= 1.11, < 1.12
|
||||||
20: Django >= 2.0, < 2.1
|
dj20: Django >= 2.0, < 2.1
|
||||||
master: https://github.com/django/django/archive/master.tar.gz
|
dj21: Django >= 2.1, < 2.2
|
||||||
|
djmaster: https://github.com/django/django/archive/master.tar.gz
|
||||||
coverage
|
coverage
|
||||||
codecov
|
codecov
|
||||||
commands =
|
commands =
|
||||||
|
|||||||
Reference in New Issue
Block a user