Merge tag 'v0.6.0'
This commit is contained in:
commit
3c445d6466
|
@ -1,3 +1,19 @@
|
||||||
*.swp
|
*.egg-info
|
||||||
*.pyc
|
*.pyc
|
||||||
venv
|
*.*~
|
||||||
|
*.orig
|
||||||
|
*.old
|
||||||
|
.*.swp
|
||||||
|
build
|
||||||
|
dist
|
||||||
|
MANIFEST
|
||||||
|
_build
|
||||||
|
_static
|
||||||
|
.project
|
||||||
|
.pydevproject
|
||||||
|
.settings
|
||||||
|
.DS_Store
|
||||||
|
.svn
|
||||||
|
.tox
|
||||||
|
.venv
|
||||||
|
*.sqlite
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
e9ddbaa0124060da683f2caf04afd5651d5a5234 v0.1.0
|
||||||
|
a84159693fb8741aaef00330fcc9cd25895ef4e8 v0.1.1
|
||||||
|
27726e15f341209ab72719fceca8752e37b6fe32 v0.1.2
|
||||||
|
253b2464507e9cb426f866c1f2561e859233ea69 v0.2.0
|
||||||
|
4ebbf2cf39b5cd8cd7f470726ac72f8516895804 v0.4.0
|
||||||
|
3e822763bab3c567e003c957786397e0fb781929 v0.3.0
|
||||||
|
628450a80e701ee4ea749d2a2e28b6023f52b64a v0.4.1
|
||||||
|
a9828ad2cef5b6961325c27cf16d4e0122a3d1f5 v0.5.0
|
||||||
|
a9828ad2cef5b6961325c27cf16d4e0122a3d1f5 v0.5.0
|
||||||
|
0000000000000000000000000000000000000000 v0.5.0
|
||||||
|
0000000000000000000000000000000000000000 v0.5.0
|
||||||
|
e03894e9208e3420fad2059e5922bc5cf9e136fc v0.5.0
|
||||||
|
615712ac8519e6a89c6d26e1febf168d0dfb50d5 v0.5.1
|
||||||
|
746357689a8db7dcf011291e717ad1328c41a29c 0.5.2
|
|
@ -0,0 +1,11 @@
|
||||||
|
language: python
|
||||||
|
sudo: false
|
||||||
|
env:
|
||||||
|
matrix:
|
||||||
|
- TOXENV=py27-dj17
|
||||||
|
- TOXENV=py27-dj18
|
||||||
|
- TOXENV=py33-dj17
|
||||||
|
- TOXENV=py33-dj18
|
||||||
|
install:
|
||||||
|
- pip install tox
|
||||||
|
script: tox
|
|
@ -0,0 +1,7 @@
|
||||||
|
[main]
|
||||||
|
host = https://www.transifex.com
|
||||||
|
|
||||||
|
[django-admin-tools.admin_tools]
|
||||||
|
file_filter = admin_tools/locale/<lang>/LC_MESSAGES/<lang>.po
|
||||||
|
source_file = admin_tools/locale/en/LC_MESSAGES/django.po
|
||||||
|
source_lang = en
|
26
CHANGELOG
26
CHANGELOG
|
@ -2,10 +2,28 @@
|
||||||
django-admin-tools changelog
|
django-admin-tools changelog
|
||||||
============================
|
============================
|
||||||
|
|
||||||
Version 0.5.2.1 (Entr'ouvert fork)
|
Version 0.6.0, 7 July 2015:
|
||||||
----------------------------------
|
---------------------------
|
||||||
* Django 1.7 support: rename migrations to south_migrations
|
|
||||||
* source code : http://repos.entrouvert.org/debian/django-admin-tools.git/
|
* VERY IMPORTANT INFORMATION, PLEASE READ: *
|
||||||
|
|
||||||
|
Starting from this version (0.6.0) django-admin-tools is no longer compatible with Django 1.6 or lower.
|
||||||
|
|
||||||
|
Users of older django version should use the 0.5.2 version available on pypi.
|
||||||
|
|
||||||
|
If you are already using django-admin-tools with django <= 1.6, be sure to pin your requirements file to a specific version, eg:
|
||||||
|
django-admin-tools==0.5.2
|
||||||
|
If you don't do this, a "pip install --upgrade" will break your admin site.
|
||||||
|
You have been warned !
|
||||||
|
|
||||||
|
Now for the actual change log:
|
||||||
|
|
||||||
|
* Dropped support for django 1.6 or lower
|
||||||
|
* Added support for django 1.8
|
||||||
|
* Cleaned up old compatibility code
|
||||||
|
* Use django builtin staticfiles
|
||||||
|
* Various improvements and bug fixes
|
||||||
|
|
||||||
|
|
||||||
Version 0.5.2, 11 August 2014:
|
Version 0.5.2, 11 August 2014:
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
10
INSTALL
10
INSTALL
|
@ -1,7 +1,13 @@
|
||||||
Thanks for downloading django-admin-tools.
|
Thanks for downloading django-admin-tools.
|
||||||
|
|
||||||
This application requires Python 2.4 or later and Django 1.1.0 or newer.
|
This application requires Python 2.7 or later and Django 1.7 or newer.
|
||||||
It is also recommended that you install the FeedParser module
|
django-admin-tools is fully compatible with Python 3.
|
||||||
|
|
||||||
|
Important note to users of django 1.6 or below: starting from 0.6.0,
|
||||||
|
django-admin-tools is *NOT* compatible with Django <= 1.6. If you want,
|
||||||
|
you can still use the 0.5.2 version.
|
||||||
|
|
||||||
|
It is recommended that you install the FeedParser module
|
||||||
(http://www.feedparser.org/) if you want to use the feed dashboard module.
|
(http://www.feedparser.org/) if you want to use the feed dashboard module.
|
||||||
|
|
||||||
To install django-admin-tools, run the following command inside this directory::
|
To install django-admin-tools, run the following command inside this directory::
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include CHANGELOG INSTALL LICENSE MANIFEST.in README AUTHORS
|
include CHANGELOG INSTALL LICENSE MANIFEST.in README.rst AUTHORS
|
||||||
recursive-include docs *
|
recursive-include docs *
|
||||||
recursive-include admin_tools/locale *
|
recursive-include admin_tools/locale *
|
||||||
recursive-include admin_tools/static *
|
recursive-include admin_tools/static *
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
django-admin-tools
|
||||||
|
==================
|
||||||
|
|
||||||
|
.. image:: https://travis-ci.org/django-admin-tools/django-admin-tools.svg?branch=master
|
||||||
|
:target: https://travis-ci.org/django-admin-tools/django-admin-tools
|
||||||
|
|
||||||
|
.. image:: https://img.shields.io/pypi/l/django-admin-tools.svg
|
||||||
|
|
||||||
|
.. image:: https://img.shields.io/pypi/pyversions/django-admin-tools.svg
|
||||||
|
|
||||||
|
.. image:: https://img.shields.io/badge/django-1.7%20or%20newer-green.svg
|
||||||
|
|
||||||
|
.. image:: https://img.shields.io/pypi/dm/django-admin-tools.svg
|
||||||
|
|
||||||
|
|
||||||
|
django-admin-tools is a collection of extensions/tools for the default django
|
||||||
|
administration interface, it includes:
|
||||||
|
|
||||||
|
* a full featured and customizable dashboard;
|
||||||
|
* a customizable menu bar;
|
||||||
|
* tools to make admin theming easier.
|
||||||
|
|
||||||
|
The code is hosted on `Github <https://github.com/django-admin-tools/django-admin-tools/>`_.
|
||||||
|
|
||||||
|
Django-admin-tools is generously documented, you can
|
||||||
|
`browse the documentation online
|
||||||
|
<http://django-admin-tools.readthedocs.org/>`_.
|
||||||
|
a good start is to read `the quickstart guide
|
||||||
|
<http://django-admin-tools.readthedocs.org/quickstart.html>`_.
|
||||||
|
|
||||||
|
The project was created by `David Jean Louis <http://www.izimobil.org/>`_ and was previously hosted on `Bitbucket <http://bitbucket.org/izi/django-admin-tools/>`_.
|
||||||
|
|
||||||
|
Please join the `mailing list <http://groups.google.fr/group/django-admin-tools>`_ if you want to discuss of the future of django-admin-tools.
|
||||||
|
|
||||||
|
************
|
||||||
|
Requirements
|
||||||
|
************
|
||||||
|
|
||||||
|
django-admin-tools requires Python 2.7 or Python 3.3 or newer and Django 1.7 or newer.
|
||||||
|
|
||||||
|
For older python and django versions please use the 0.5.2 version of django-admin-tools which is available on Pypi.
|
||||||
|
|
||||||
|
************
|
||||||
|
Installation
|
||||||
|
************
|
||||||
|
|
||||||
|
To install django-admin-tools, run the following command inside this directory:
|
||||||
|
|
||||||
|
python setup.py install
|
||||||
|
|
||||||
|
If you have the Python **easy_install** utility available, you can also type
|
||||||
|
the following to download and install in one step::
|
||||||
|
|
||||||
|
easy_install django-admin-tools
|
||||||
|
|
||||||
|
Or if you're using **pip**::
|
||||||
|
|
||||||
|
pip install django-admin-tools
|
||||||
|
|
||||||
|
Or if you'd prefer you can simply place the included "admin_tools" directory
|
||||||
|
somewhere on your python path, or symlink to it from somewhere on your Python
|
||||||
|
path; this is useful if you're working from a Mercurial checkout.
|
||||||
|
|
||||||
|
An `installation guide <http://django-admin-tools.readthedocs.org/en/latest/installation.html>`_ is available in the documentation.
|
||||||
|
|
||||||
|
*************
|
||||||
|
Documentation
|
||||||
|
*************
|
||||||
|
|
||||||
|
`Extensive documentation <http://django-admin-tools.readthedocs.org/>`_ is available, it was made with the excellent `Sphinx program <http://sphinx.pocoo.org/>`_
|
||||||
|
|
||||||
|
************
|
||||||
|
Translations
|
||||||
|
************
|
||||||
|
|
||||||
|
There is a `a transifex project <https://transifex.net/projects/p/django-admin-tools/>`_ for django-admin-tools.
|
||||||
|
|
||||||
|
************
|
||||||
|
Screenshots
|
||||||
|
************
|
||||||
|
|
||||||
|
The django admin login screen:
|
||||||
|
|
||||||
|
.. image:: http://www.izimobil.org/django-admin-tools/images/capture-1.png
|
||||||
|
:alt: The django admin login screen
|
||||||
|
|
||||||
|
|
||||||
|
The admin index dashboard:
|
||||||
|
|
||||||
|
.. image:: http://www.izimobil.org/django-admin-tools/images/capture-2.png
|
||||||
|
:alt: The admin index dashboard
|
||||||
|
|
||||||
|
|
||||||
|
The admin menu:
|
||||||
|
|
||||||
|
.. image:: http://www.izimobil.org/django-admin-tools/images/capture-3.png
|
||||||
|
:alt: The admin menu
|
||||||
|
|
||||||
|
Dashboard modules can be dragged, collapsed, closed etc.:
|
||||||
|
|
||||||
|
.. image:: http://www.izimobil.org/django-admin-tools/images/capture-4.png
|
||||||
|
:alt: Dashboard modules can be dragged, collapsed, closed etc.
|
||||||
|
|
||||||
|
The app index dashboard:
|
||||||
|
|
||||||
|
.. image:: http://www.izimobil.org/django-admin-tools/images/capture-5.png
|
||||||
|
:alt: The app index dashboard
|
||||||
|
|
|
@ -6,4 +6,4 @@ administration interface, it includes:
|
||||||
* a customizable menu bar,
|
* a customizable menu bar,
|
||||||
* tools to make admin theming easier.
|
* tools to make admin theming easier.
|
||||||
"""
|
"""
|
||||||
VERSION = '0.5.2.1'
|
VERSION = '0.6.0'
|
||||||
|
|
|
@ -3,15 +3,15 @@ Module where admin tools dashboard classes are defined.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.template.defaultfilters import slugify
|
from django.template.defaultfilters import slugify
|
||||||
from django.utils.importlib import import_module
|
try:
|
||||||
|
from importlib import import_module
|
||||||
|
except ImportError:
|
||||||
|
# Django < 1.9 and Python < 2.7
|
||||||
|
from django.utils.importlib import import_module
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
try:
|
from django.utils.encoding import force_text
|
||||||
from django.utils.encoding import force_text
|
|
||||||
except ImportError:
|
|
||||||
# Django < 1.5
|
|
||||||
from django.utils.encoding import force_unicode as force_text
|
|
||||||
|
|
||||||
from admin_tools.dashboard import modules
|
from admin_tools.dashboard import modules
|
||||||
from admin_tools.utils import get_admin_site_name, uniquify
|
from admin_tools.utils import get_admin_site_name, uniquify
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DashboardPreferences',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
|
('data', models.TextField()),
|
||||||
|
('dashboard_id', models.CharField(max_length=100)),
|
||||||
|
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('user',),
|
||||||
|
'db_table': 'admin_tools_dashboard_preferences',
|
||||||
|
},
|
||||||
|
bases=(models.Model,),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='dashboardpreferences',
|
||||||
|
unique_together=set([('user', 'dashboard_id')]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
__author__ = 'andybaker'
|
|
@ -5,7 +5,7 @@ Module where admin tools dashboard modules classes are defined.
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.forms.util import flatatt
|
from django.forms.utils import flatatt
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.itercompat import is_iterable
|
from django.utils.itercompat import is_iterable
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,11 @@ def autodiscover(blacklist=[]):
|
||||||
"""
|
"""
|
||||||
import imp
|
import imp
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.importlib import import_module
|
try:
|
||||||
|
from importlib import import_module
|
||||||
|
except ImportError:
|
||||||
|
# Django < 1.9 and Python < 2.7
|
||||||
|
from django.utils.importlib import import_module
|
||||||
|
|
||||||
blacklist.append('admin_tools.dashboard')
|
blacklist.append('admin_tools.dashboard')
|
||||||
blacklist.append('admin_tools.menu')
|
blacklist.append('admin_tools.menu')
|
||||||
|
|
|
@ -4,6 +4,14 @@ from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from south import modelsinspector
|
||||||
|
|
||||||
|
try:
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
UserModel = get_user_model()
|
||||||
|
except ImportError:
|
||||||
|
from django.contrib.auth.models import User as UserModel
|
||||||
|
|
||||||
|
|
||||||
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
|
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
|
||||||
|
|
||||||
|
@ -11,7 +19,7 @@ user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
def forwards(self, orm):
|
def forwards(self, orm):
|
||||||
|
|
||||||
# Adding model 'DashboardPreferences'
|
# Adding model 'DashboardPreferences'
|
||||||
db.create_table('admin_tools_dashboard_preferences', (
|
db.create_table('admin_tools_dashboard_preferences', (
|
||||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||||
|
@ -22,7 +30,7 @@ class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
|
|
||||||
# Deleting model 'DashboardPreferences'
|
# Deleting model 'DashboardPreferences'
|
||||||
db.delete_table('admin_tools_dashboard_preferences')
|
db.delete_table('admin_tools_dashboard_preferences')
|
||||||
|
|
||||||
|
@ -42,7 +50,7 @@ class Migration(SchemaMigration):
|
||||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
},
|
},
|
||||||
user_model: {
|
user_model: {
|
||||||
'Meta': {'object_name': user_model.split('.')[1]},
|
'Meta': modelsinspector.get_model_meta(UserModel),
|
||||||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "admin/base_site.html" %}
|
{% extends "admin/base_site.html" %}
|
||||||
{% load i18n admin_tools_dashboard_tags %}
|
{% load i18n admin_static admin_tools_dashboard_tags %}
|
||||||
|
|
||||||
{% block extrastyle %}
|
{% block extrastyle %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<link rel="stylesheet" href="{{ media_url }}/admin_tools/css/jquery/jquery-ui.css" type="text/css" media="screen, projection"/>
|
{% load staticfiles %}
|
||||||
<link rel="stylesheet" href="{{ media_url }}/admin_tools/css/dashboard.css" type="text/css" media="screen, projection"/>
|
<link rel="stylesheet" href="{% static "admin_tools/css/jquery/jquery-ui.css" %}" type="text/css" media="screen, projection"/>
|
||||||
|
<link rel="stylesheet" href="{% static "admin_tools/css/dashboard.css" %}" type="text/css" media="screen, projection"/>
|
||||||
<!--[if lt IE 8]>
|
<!--[if lt IE 8]>
|
||||||
<link rel="stylesheet" href="{{ media_url }}/admin_tools/css/dashboard-ie.css" type="text/css" media="screen, projection"/>
|
<link rel="stylesheet" href="{% static "admin_tools/css/dashboard-ie.css" %}" type="text/css" media="screen, projection"/>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
{% for css in css_files %}
|
{% for media_type, files in css_files.items %}{% for css in files %}
|
||||||
<link rel="stylesheet" href="{{ media_url }}/{{ css }}" type="text/css" media="screen, projection"/>{% endfor %}
|
<link rel="stylesheet" href="{% static css %}" type="text/css" media="{{ media_type }}"/>{% endfor %}{% endfor %}
|
||||||
|
|
|
@ -1,39 +1,38 @@
|
||||||
{% load i18n admin_tools_dashboard_tags %}
|
{% load i18n staticfiles admin_tools_dashboard_tags %}
|
||||||
{% load url from future %}
|
|
||||||
|
|
||||||
{% block dashboard_scripts %}
|
{% block dashboard_scripts %}
|
||||||
<script type="text/javascript" src="{{ media_url }}/admin_tools/js/utils.js"></script>
|
<script type="text/javascript" src="{% static "admin_tools/js/utils.js" %}"></script>
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
// Load js files syncronously and conditionally
|
// Load js files syncronously and conditionally
|
||||||
|
|
||||||
var js_files = [
|
var js_files = [
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/jquery/jquery.min.js',
|
src : '{% static "admin_tools/js/jquery/jquery.min.js" %}',
|
||||||
test: function() { return typeof(jQuery) == 'undefined'; }
|
test: function() { return typeof(jQuery) == 'undefined'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/jquery/jquery-ui.min.js',
|
src : '{% static "admin_tools/js/jquery/jquery-ui.min.js" %}',
|
||||||
test: function() { return typeof(jQuery.ui) == 'undefined'; }
|
test: function() { return typeof(jQuery.ui) == 'undefined'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/json.min.js',
|
src : '{% static "admin_tools/js/json.min.js" %}',
|
||||||
test: function() { return typeof(JSON.stringify) == 'undefined'; }
|
test: function() { return typeof(JSON.stringify) == 'undefined'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/jquery/jquery.cookie.min.js',
|
src : '{% static "admin_tools/js/jquery/jquery.cookie.min.js" %}',
|
||||||
test: function() { return typeof(jQuery.cookie) == 'undefined'; }
|
test: function() { return typeof(jQuery.cookie) == 'undefined'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/jquery/jquery.dashboard.js',
|
src : '{% static "admin_tools/js/jquery/jquery.dashboard.js" %}',
|
||||||
test: function() { return true; }
|
test: function() { return true; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/dashboard.js',
|
src : '{% static "admin_tools/js/dashboard.js" %}',
|
||||||
test: function() { return true; }
|
test: function() { return true; }
|
||||||
}{% for js in dashboard.Media.js %},
|
}{% for js in dashboard.Media.js %},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/{{ js }}',
|
src : '{% static js %}',
|
||||||
test: function() { return true; }
|
test: function() { return true; }
|
||||||
}{% endfor %}
|
}{% endfor %}
|
||||||
];
|
];
|
||||||
|
@ -79,4 +78,4 @@
|
||||||
{% for module in dashboard.children %}
|
{% for module in dashboard.children %}
|
||||||
{% admin_tools_render_dashboard_module module %}{% endfor %}
|
{% admin_tools_render_dashboard_module module %}{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{% extends "admin_tools/dashboard/module.html" %}
|
{% extends "admin_tools/dashboard/module.html" %}
|
||||||
|
{% load cycle from future %}
|
||||||
{% block module_content %}
|
{% block module_content %}
|
||||||
<ul>
|
<ul>
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{% extends "admin_tools/dashboard/module.html" %}
|
{% extends "admin_tools/dashboard/module.html" %}
|
||||||
|
{% load cycle from future %}
|
||||||
{% block module_content %}
|
{% block module_content %}
|
||||||
<ul class="{{ module.layout }}">
|
<ul class="{{ module.layout }}">
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "admin_tools/dashboard/module.html" %}
|
{% extends "admin_tools/dashboard/module.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}{% load cycle from future %}
|
||||||
{% block module_content %}
|
{% block module_content %}
|
||||||
<ul>
|
<ul>
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
|
|
|
@ -13,7 +13,7 @@ from django import template
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from admin_tools.utils import get_media_url, get_admin_site_name
|
from admin_tools.utils import get_admin_site_name
|
||||||
from admin_tools.dashboard.utils import get_dashboard
|
from admin_tools.dashboard.utils import get_dashboard
|
||||||
from admin_tools.dashboard.models import DashboardPreferences
|
from admin_tools.dashboard.models import DashboardPreferences
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@ def admin_tools_render_dashboard(context, location='index', dashboard=None):
|
||||||
'dashboard': dashboard,
|
'dashboard': dashboard,
|
||||||
'dashboard_preferences': preferences,
|
'dashboard_preferences': preferences,
|
||||||
'split_at': math.ceil(float(len(dashboard.children))/float(dashboard.columns)),
|
'split_at': math.ceil(float(len(dashboard.children))/float(dashboard.columns)),
|
||||||
'media_url': get_media_url(),
|
|
||||||
'has_disabled_modules': len([m for m in dashboard.children \
|
'has_disabled_modules': len([m for m in dashboard.children \
|
||||||
if not m.enabled]) > 0,
|
if not m.enabled]) > 0,
|
||||||
'admin_url': reverse('%s:index' % get_admin_site_name(context)),
|
'admin_url': reverse('%s:index' % get_admin_site_name(context)),
|
||||||
|
@ -108,7 +107,6 @@ def admin_tools_render_dashboard_css(context, location='index', dashboard=None):
|
||||||
context.update({
|
context.update({
|
||||||
'template' : 'admin_tools/dashboard/css.html',
|
'template' : 'admin_tools/dashboard/css.html',
|
||||||
'css_files': dashboard.Media.css,
|
'css_files': dashboard.Media.css,
|
||||||
'media_url': get_media_url(),
|
|
||||||
})
|
})
|
||||||
return context
|
return context
|
||||||
admin_tools_render_dashboard_css = tag_func(admin_tools_render_dashboard_css)
|
admin_tools_render_dashboard_css = tag_func(admin_tools_render_dashboard_css)
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
try:
|
from django.conf.urls import patterns, url
|
||||||
from django.conf.urls import patterns, url
|
|
||||||
except ImportError: # django < 1.4
|
|
||||||
from django.conf.urls.defaults import patterns, url
|
|
||||||
|
|
||||||
urlpatterns = patterns('admin_tools.dashboard.views',
|
urlpatterns = patterns('admin_tools.dashboard.views',
|
||||||
url(r'^set_preferences/(?P<dashboard_id>.+)/$', 'set_preferences', name='admin-tools-dashboard-set-preferences'),
|
url(r'^set_preferences/(?P<dashboard_id>.+)/$', 'set_preferences', name='admin-tools-dashboard-set-preferences'),
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
Dashboard utilities.
|
Dashboard utilities.
|
||||||
"""
|
"""
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.importlib import import_module
|
try:
|
||||||
|
from importlib import import_module
|
||||||
|
except ImportError:
|
||||||
|
# Django < 1.9 and Python < 2.7
|
||||||
|
from django.utils.importlib import import_module
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,132 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# Sergey Lysach <sergikoff88@gmail.com>, 2011
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: django-admin-tools\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2011-01-27 08:34+0100\n"
|
||||||
|
"PO-Revision-Date: 2015-07-04 13:50+0000\n"
|
||||||
|
"Last-Translator: izi <izimobil@gmail.com>\n"
|
||||||
|
"Language-Team: Ukrainian (http://www.transifex.com/projects/p/django-admin-tools/language/uk/)\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: uk\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:81 menu/menus.py:100
|
||||||
|
msgid "Dashboard"
|
||||||
|
msgstr "Панель управління"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:217
|
||||||
|
msgid "Quick links"
|
||||||
|
msgstr "Швидкі посилання"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:223
|
||||||
|
msgid "Return to site"
|
||||||
|
msgstr "Повернутися на сайт"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:224 theming/templates/admin/base.html:43
|
||||||
|
msgid "Change password"
|
||||||
|
msgstr "Змінити пароль"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:226 theming/templates/admin/base.html:50
|
||||||
|
msgid "Log out"
|
||||||
|
msgstr "Вийти"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:232 dashboard/modules.py:385 menu/menus.py:103
|
||||||
|
msgid "Applications"
|
||||||
|
msgstr "Програми-додатки"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:238 menu/menus.py:107
|
||||||
|
msgid "Administration"
|
||||||
|
msgstr "Адміністрування"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:243 dashboard/dashboards.py:297
|
||||||
|
#: dashboard/modules.py:538
|
||||||
|
msgid "Recent Actions"
|
||||||
|
msgstr "Останні Дії"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:247
|
||||||
|
msgid "Latest Django News"
|
||||||
|
msgstr "Останні новини Django"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:254
|
||||||
|
msgid "Support"
|
||||||
|
msgstr "Підтримка"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:257
|
||||||
|
msgid "Django documentation"
|
||||||
|
msgstr "Документація Django"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:262
|
||||||
|
msgid "Django \"django-users\" mailing list"
|
||||||
|
msgstr "Django \"django-users\" гугл група"
|
||||||
|
|
||||||
|
#: dashboard/dashboards.py:267
|
||||||
|
msgid "Django irc channel"
|
||||||
|
msgstr "IRC канал Django"
|
||||||
|
|
||||||
|
#: dashboard/modules.py:314
|
||||||
|
msgid "Links"
|
||||||
|
msgstr "Посилання"
|
||||||
|
|
||||||
|
#: dashboard/modules.py:591
|
||||||
|
msgid "No recent actions."
|
||||||
|
msgstr "Немає недавніх дій."
|
||||||
|
|
||||||
|
#: dashboard/modules.py:637
|
||||||
|
msgid "RSS Feed"
|
||||||
|
msgstr "RSS-канал"
|
||||||
|
|
||||||
|
#: dashboard/templates/admin/app_index.html:9
|
||||||
|
#: theming/templates/admin/base.html:57
|
||||||
|
msgid "Home"
|
||||||
|
msgstr "Головна"
|
||||||
|
|
||||||
|
#: dashboard/templates/admin/app_index.html:11
|
||||||
|
#, python-format
|
||||||
|
msgid "%(name)s"
|
||||||
|
msgstr "%(name)s"
|
||||||
|
|
||||||
|
#: dashboard/templates/admin_tools/dashboard/dashboard.html:55
|
||||||
|
msgid "Modules"
|
||||||
|
msgstr "Модулі"
|
||||||
|
|
||||||
|
#: dashboard/templates/admin_tools/dashboard/modules/app_list.html:13
|
||||||
|
#: dashboard/templates/admin_tools/dashboard/modules/model_list.html:11
|
||||||
|
msgid "Add"
|
||||||
|
msgstr "Додати"
|
||||||
|
|
||||||
|
#: dashboard/templates/admin_tools/dashboard/modules/app_list.html:14
|
||||||
|
#: dashboard/templates/admin_tools/dashboard/modules/model_list.html:12
|
||||||
|
msgid "Change"
|
||||||
|
msgstr "Змінити"
|
||||||
|
|
||||||
|
#: menu/items.py:328
|
||||||
|
msgid "Bookmarks"
|
||||||
|
msgstr "Закладки"
|
||||||
|
|
||||||
|
#: menu/templates/admin/base_site.html:4
|
||||||
|
msgid "Django site admin"
|
||||||
|
msgstr "Панель управління"
|
||||||
|
|
||||||
|
#: menu/templates/admin/base_site.html:16
|
||||||
|
msgid "Django administration"
|
||||||
|
msgstr "Django адміністрування"
|
||||||
|
|
||||||
|
#: menu/templates/admin_tools/menu/menu.html:32
|
||||||
|
msgid "Please enter a name for the bookmark"
|
||||||
|
msgstr "Будь ласка, введіть ім'я закладки"
|
||||||
|
|
||||||
|
#: theming/templates/admin/base.html:30
|
||||||
|
msgid "Welcome,"
|
||||||
|
msgstr "Ласкаво просимо,"
|
||||||
|
|
||||||
|
#: theming/templates/admin/base.html:35
|
||||||
|
msgid "Documentation"
|
||||||
|
msgstr "Документація"
|
|
@ -0,0 +1,29 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Bookmark',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
|
('url', models.CharField(max_length=255)),
|
||||||
|
('title', models.CharField(max_length=255)),
|
||||||
|
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('id',),
|
||||||
|
'db_table': 'admin_tools_menu_bookmark',
|
||||||
|
},
|
||||||
|
bases=(models.Model,),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
__author__ = 'andybaker'
|
|
@ -4,6 +4,14 @@ from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from south import modelsinspector
|
||||||
|
|
||||||
|
try:
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
UserModel = get_user_model()
|
||||||
|
except ImportError:
|
||||||
|
from django.contrib.auth.models import User as UserModel
|
||||||
|
|
||||||
|
|
||||||
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
|
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
|
||||||
|
|
||||||
|
@ -41,7 +49,7 @@ class Migration(SchemaMigration):
|
||||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
},
|
},
|
||||||
user_model: {
|
user_model: {
|
||||||
'Meta': {'object_name': user_model.split('.')[1]},
|
'Meta': modelsinspector.get_model_meta(UserModel),
|
||||||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "admin/base.html" %}
|
{% extends "admin/base.html" %}
|
||||||
{% load i18n admin_tools_menu_tags %}
|
{% load admin_tools_menu_tags %}
|
||||||
|
|
||||||
{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}
|
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
|
||||||
|
|
||||||
{% block extrastyle %}
|
{% block extrastyle %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block branding %}
|
{% block branding %}
|
||||||
<h1 id="site-name">{% trans 'Django administration' %}</h1>
|
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block nav-global %}
|
{% block nav-global %}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% load url from future %}
|
{% load firstof from future %}
|
||||||
{% url 'admin-tools-menu-add-bookmark' as form_url %}
|
{% url 'admin-tools-menu-add-bookmark' as form_url %}
|
||||||
{% if form_url %}
|
{% if form_url %}
|
||||||
<form id="bookmark-form" action="{{ form_url }}" method="POST">
|
<form id="bookmark-form" action="{{ form_url }}" method="POST">
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<link rel="stylesheet" href="{{ media_url }}/admin_tools/css/menu.css" type="text/css" media="screen, projection"/>
|
{% load staticfiles %}
|
||||||
|
<link rel="stylesheet" href="{% static "admin_tools/css/menu.css" %}" type="text/css" media="screen, projection"/>
|
||||||
<!--[if lt IE 8]>
|
<!--[if lt IE 8]>
|
||||||
<link rel="stylesheet" href="{{ media_url }}/admin_tools/css/menu-ie.css" type="text/css" media="screen, projection"/>
|
<link rel="stylesheet" href="{% static "admin_tools/css/menu-ie.css" type="text/css" media="screen, projection"/>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
{% for css in css_files %}
|
{% for media_type, files in css_files.items %}{% for css in files %}
|
||||||
<link rel="stylesheet" href="{{ media_url }}/{{ css }}" type="text/css" media="screen, projection"/>{% endfor %}
|
<link rel="stylesheet" href="{% static css %}" type="text/css" media="{{ media_type }}"/>{% endfor %}{% endfor %}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
{% load i18n admin_tools_menu_tags %}
|
{% load i18n staticfiles admin_tools_menu_tags %}
|
||||||
{% if menu.children %}
|
{% if menu.children %}
|
||||||
<script type="text/javascript" src="{{ media_url }}/admin_tools/js/utils.js"></script>
|
<script type="text/javascript" src="{% static "admin_tools/js/utils.js" %}"></script>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
|
||||||
// Load js files syncronously and conditionally
|
// Load js files syncronously and conditionally
|
||||||
var js_files = [
|
var js_files = [
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/jquery/jquery.min.js',
|
src : '{% static "admin_tools/js/jquery/jquery.min.js" %}',
|
||||||
test: function() { return typeof(jQuery) == 'undefined'; }
|
test: function() { return typeof(jQuery) == 'undefined'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/json.min.js',
|
src : '{% static "admin_tools/js/json.min.js" %}',
|
||||||
test: function() { return typeof(JSON.stringify) == 'undefined'; }
|
test: function() { return typeof(JSON.stringify) == 'undefined'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/admin_tools/js/menu.js',
|
src : '{% static "admin_tools/js/menu.js" %}',
|
||||||
test: function() { return true; }
|
test: function() { return true; }
|
||||||
}{% for js in menu.Media.js %},
|
}{% for js in menu.Media.js %},
|
||||||
{
|
{
|
||||||
src : '{{ media_url }}/{{ js }}',
|
src : '{% static js %}',
|
||||||
test: function() { return true; }
|
test: function() { return true; }
|
||||||
}{% endfor %}
|
}{% endfor %}
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% load url from future %}
|
{% load firstof from future %}
|
||||||
{% url 'admin-tools-menu-remove-bookmark' bookmark.id as form_url%}
|
{% url 'admin-tools-menu-remove-bookmark' bookmark.id as form_url%}
|
||||||
{% if form_url %}
|
{% if form_url %}
|
||||||
<form id="bookmark-form" action="{{ form_url }}" method="POST">
|
<form id="bookmark-form" action="{{ form_url }}" method="POST">
|
||||||
|
|
|
@ -11,7 +11,7 @@ To load the menu tags in your templates: ``{% load admin_tools_menu_tags %}``.
|
||||||
from django import template
|
from django import template
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from admin_tools.utils import get_media_url, get_admin_site_name
|
from admin_tools.utils import get_admin_site_name
|
||||||
from admin_tools.menu import items
|
from admin_tools.menu import items
|
||||||
from admin_tools.menu.models import Bookmark
|
from admin_tools.menu.models import Bookmark
|
||||||
from admin_tools.menu.utils import get_admin_menu
|
from admin_tools.menu.utils import get_admin_menu
|
||||||
|
@ -42,7 +42,6 @@ def admin_tools_render_menu(context, menu=None):
|
||||||
context.update({
|
context.update({
|
||||||
'template': menu.template,
|
'template': menu.template,
|
||||||
'menu': menu,
|
'menu': menu,
|
||||||
'media_url': get_media_url(),
|
|
||||||
'has_bookmark_item': has_bookmark_item,
|
'has_bookmark_item': has_bookmark_item,
|
||||||
'bookmark': bookmark,
|
'bookmark': bookmark,
|
||||||
'admin_url': reverse('%s:index' % get_admin_site_name(context)),
|
'admin_url': reverse('%s:index' % get_admin_site_name(context)),
|
||||||
|
@ -81,7 +80,6 @@ def admin_tools_render_menu_css(context, menu=None):
|
||||||
context.update({
|
context.update({
|
||||||
'template': 'admin_tools/menu/css.html',
|
'template': 'admin_tools/menu/css.html',
|
||||||
'css_files': menu.Media.css,
|
'css_files': menu.Media.css,
|
||||||
'media_url': get_media_url(),
|
|
||||||
})
|
})
|
||||||
return context
|
return context
|
||||||
admin_tools_render_menu_css = tag_func(admin_tools_render_menu_css)
|
admin_tools_render_menu_css = tag_func(admin_tools_render_menu_css)
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
try:
|
from django.conf.urls import patterns, url
|
||||||
from django.conf.urls import patterns, url
|
|
||||||
except ImportError: # django < 1.4
|
|
||||||
from django.conf.urls.defaults import patterns, url
|
|
||||||
|
|
||||||
urlpatterns = patterns('admin_tools.menu.views',
|
urlpatterns = patterns('admin_tools.menu.views',
|
||||||
url(r'^add_bookmark/$', 'add_bookmark', name='admin-tools-menu-add-bookmark'),
|
url(r'^add_bookmark/$', 'add_bookmark', name='admin-tools-menu-add-bookmark'),
|
||||||
|
|
|
@ -3,7 +3,11 @@ Menu utilities.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.importlib import import_module
|
try:
|
||||||
|
from importlib import import_module
|
||||||
|
except ImportError:
|
||||||
|
# Django < 1.9 and Python < 2.7
|
||||||
|
from django.utils.importlib import import_module
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
{% load url from future %}
|
{% load admin_static theming_tags %}{% load firstof from future %}<!DOCTYPE html>
|
||||||
{% load theming_tags %}
|
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
|
|
||||||
<head>
|
<head>
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% get_admin_media "css/base.css" %}{% endblock %}" />
|
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static "admin/css/base.css" %}{% endblock %}" />
|
||||||
{% block extrastyle %}{% endblock %}
|
{% block extrastyle %}{% endblock %}
|
||||||
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}{% get_admin_media "css/ie.css" %}{% endblock %}" /><![endif]-->
|
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}{% static "admin/css/ie.css" %}{% endblock %}" /><![endif]-->
|
||||||
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% get_admin_media "css/rtl.css" %}{% endblock %}" />{% endif %}
|
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}" />{% endif %}
|
||||||
{% render_theming_css %}
|
{% render_theming_css %}
|
||||||
<script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% get_admin_media %}{% endfilter %}";</script>
|
<script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";</script>
|
||||||
|
<script type="text/javascript">window.__admin_utc_offset__ = "{% filter escapejs %}{% now "Z" %}{% endfilter %}";</script>
|
||||||
{% block extrahead %}{% endblock %}
|
{% block extrahead %}{% endblock %}
|
||||||
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
|
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
@ -28,27 +27,19 @@
|
||||||
</div>
|
</div>
|
||||||
{% if user.is_active and user.is_staff %}
|
{% if user.is_active and user.is_staff %}
|
||||||
<div id="user-tools">
|
<div id="user-tools">
|
||||||
{% trans 'Welcome,' %}
|
{% block welcome-msg %}
|
||||||
<strong>{% filter force_escape %}{% firstof user.get_short_name user.first_name user.get_username user.username %}{% endfilter %}</strong>.
|
{% trans 'Welcome,' %}
|
||||||
|
<strong>{% firstof user.get_short_name user.get_username %}</strong>.
|
||||||
|
{% endblock %}
|
||||||
{% block userlinks %}
|
{% block userlinks %}
|
||||||
{% url 'django-admindocs-docroot' as docsroot %}
|
{% url 'django-admindocs-docroot' as docsroot %}
|
||||||
{% if docsroot %}
|
{% if docsroot %}
|
||||||
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
|
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% url 'admin:password_change' as password_change_url %}
|
{% if user.has_usable_password %}
|
||||||
{% if password_change_url %}
|
<a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a> /
|
||||||
<a href="{{ password_change_url }}">
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ root_path }}password_change/">
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% trans 'Change password' %}</a> /
|
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
|
||||||
{% url 'admin:logout' as logout_url %}
|
|
||||||
{% if logout_url %}
|
|
||||||
<a href="{{ logout_url }}">
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ root_path }}logout/">
|
|
||||||
{% endif %}
|
|
||||||
{% trans 'Log out' %}</a>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -63,11 +54,13 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% block messages %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
<ul class="messagelist">{% for message in messages %}
|
<ul class="messagelist">{% for message in messages %}
|
||||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message|capfirst }}</li>
|
||||||
{% endfor %}</ul>
|
{% endfor %}</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endblock messages %}
|
||||||
|
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
<div id="content" class="{% block coltype %}colM{% endblock %}">
|
<div id="content" class="{% block coltype %}colM{% endblock %}">
|
||||||
|
|
|
@ -6,7 +6,7 @@ To load the theming tags just do: ``{% load theming_tags %}``.
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from admin_tools.utils import get_media_url
|
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
@ -15,21 +15,7 @@ def render_theming_css():
|
||||||
Template tag that renders the needed css files for the theming app.
|
Template tag that renders the needed css files for the theming app.
|
||||||
"""
|
"""
|
||||||
css = getattr(settings, 'ADMIN_TOOLS_THEMING_CSS', False)
|
css = getattr(settings, 'ADMIN_TOOLS_THEMING_CSS', False)
|
||||||
if css:
|
if not css:
|
||||||
css = '/'.join([get_media_url(), css])
|
css = '/'.join(['admin_tools', 'css', 'theming.css'])
|
||||||
else:
|
return '<link rel="stylesheet" type="text/css" media="screen" href="%s" />' % staticfiles_storage.url(css)
|
||||||
css = '/'.join([get_media_url(), 'admin_tools', 'css', 'theming.css'])
|
|
||||||
return '<link rel="stylesheet" type="text/css" media="screen" href="%s" />' % css
|
|
||||||
register.simple_tag(render_theming_css)
|
register.simple_tag(render_theming_css)
|
||||||
|
|
||||||
|
|
||||||
def get_admin_media(media=''):
|
|
||||||
"""
|
|
||||||
Template tag that renders the needed css files for the theming app.
|
|
||||||
"""
|
|
||||||
return getattr(
|
|
||||||
settings,
|
|
||||||
'ADMIN_MEDIA_PREFIX', # django 1.3
|
|
||||||
'%sadmin/' % getattr(settings, 'STATIC_URL') # django > 1.4
|
|
||||||
) + media
|
|
||||||
register.simple_tag(get_admin_media)
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
try:
|
from django.conf.urls import patterns, url, include
|
||||||
from django.conf.urls import patterns, url, include
|
|
||||||
except ImportError: # django < 1.4
|
|
||||||
from django.conf.urls.defaults import patterns, url, include
|
|
||||||
|
|
||||||
urls = []
|
urls = []
|
||||||
if 'admin_tools.menu' in settings.INSTALLED_APPS:
|
if 'admin_tools.menu' in settings.INSTALLED_APPS:
|
||||||
|
|
|
@ -6,7 +6,11 @@ from fnmatch import fnmatch
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.importlib import import_module
|
try:
|
||||||
|
from importlib import import_module
|
||||||
|
except ImportError:
|
||||||
|
# Django < 1.9 and Python < 2.7
|
||||||
|
from django.utils.importlib import import_module
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
def uniquify(value, seen_values):
|
def uniquify(value, seen_values):
|
||||||
|
@ -150,14 +154,3 @@ class AppListElementMixin(object):
|
||||||
return reverse('%s:%s_%s_add' % (get_admin_site_name(context),
|
return reverse('%s:%s_%s_add' % (get_admin_site_name(context),
|
||||||
app_label,
|
app_label,
|
||||||
model.__name__.lower()))
|
model.__name__.lower()))
|
||||||
|
|
||||||
def get_media_url():
|
|
||||||
"""
|
|
||||||
Returns the django admin tools media URL.
|
|
||||||
"""
|
|
||||||
media_url = getattr(settings, 'ADMIN_TOOLS_MEDIA_URL', None)
|
|
||||||
if media_url is None:
|
|
||||||
media_url = getattr(settings, 'STATIC_URL', None)
|
|
||||||
if media_url is None:
|
|
||||||
media_url = getattr(settings, 'MEDIA_URL')
|
|
||||||
return media_url.rstrip('/')
|
|
||||||
|
|
|
@ -33,6 +33,12 @@ Required settings
|
||||||
First make sure you have the ``django.core.context_processors.request``
|
First make sure you have the ``django.core.context_processors.request``
|
||||||
template context processor in your ``TEMPLATE_CONTEXT_PROCESSORS``.
|
template context processor in your ``TEMPLATE_CONTEXT_PROCESSORS``.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Starting from django 1.8, ``TEMPLATE_CONTEXT_PROCESSORS`` is deprecated,
|
||||||
|
you must add the request context processor in your ``TEMPLATES`` variable
|
||||||
|
instead, please refer to the
|
||||||
|
`relevant django documentation <https://docs.djangoproject.com/en/1.8/ref/templates/upgrading/>`_.
|
||||||
|
|
||||||
Then, add the django-admin-tools modules to the ``INSTALLED_APPS`` like
|
Then, add the django-admin-tools modules to the ``INSTALLED_APPS`` like
|
||||||
this::
|
this::
|
||||||
|
|
||||||
|
@ -69,13 +75,7 @@ Setting up the database
|
||||||
|
|
||||||
To set up the tables that django-admin-tools uses you'll need to type::
|
To set up the tables that django-admin-tools uses you'll need to type::
|
||||||
|
|
||||||
python manage.py syncdb
|
python manage.py migrate
|
||||||
|
|
||||||
django-admin-tools supports `South <http://south.aeracode.org>`_, so if you
|
|
||||||
have South installed, make sure you run the following commands::
|
|
||||||
|
|
||||||
python manage.py migrate admin_tools.dashboard
|
|
||||||
python manage.py migrate admin_tools.menu
|
|
||||||
|
|
||||||
Adding django-admin-tools to your urls.py file
|
Adding django-admin-tools to your urls.py file
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -4,19 +4,17 @@ Contributing to django-admin-tools
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
You are very welcome to contribute to the project! django-admin-tools is
|
You are very welcome to contribute to the project! django-admin-tools is
|
||||||
hosted at `Bitbucket <http://www.bitbucket.org/izi/django-admin-tools/>`_,
|
on `Github <https://github.com/django-admin-tools/django-admin-tools>`_,
|
||||||
which makes collaborating very easy.
|
which makes collaborating very easy.
|
||||||
|
|
||||||
There are various possibilities to get involved, for example you can:
|
There are various possibilities to get involved, for example you can:
|
||||||
|
|
||||||
* `Report bugs <http://www.bitbucket.org/izi/django-admin-tools/issues/new/>`_,
|
* `Report bugs <https://github.com/django-admin-tools/django-admin-tools/issues/new>`_,
|
||||||
preferably with patches if you can
|
preferably with patches if you can
|
||||||
* `Discuss new features ideas
|
* `Discuss new features ideas
|
||||||
<http://groups.google.fr/group/django-admin-tools>`_
|
<http://groups.google.fr/group/django-admin-tools>`_
|
||||||
* `fork the project <http://www.bitbucket.org/izi/django-admin-tools/fork/>`_,
|
* Fork the project, implement those features and send a pull request
|
||||||
implement those features and send a pull request
|
* Enhance the `documentation <http://django-admin-tools.readthedocs.org/en/latest/>`_
|
||||||
* Enhance the `documentation
|
|
||||||
<http://www.bitbucket.org/izi/django-admin-tools/src/tip/docs/>`_
|
|
||||||
* `Translate django-admin-tools
|
* `Translate django-admin-tools
|
||||||
<https://www.transifex.net/projects/p/django-admin-tools/c/admin_tools/>`_
|
<https://www.transifex.net/projects/p/django-admin-tools/c/admin_tools/>`_
|
||||||
in your language
|
in your language
|
||||||
|
|
|
@ -11,9 +11,9 @@ custom modules.
|
||||||
..note::
|
..note::
|
||||||
If your layout seems to be broken or you have problems with
|
If your layout seems to be broken or you have problems with
|
||||||
included javascript files, you should try to reset your dashboard
|
included javascript files, you should try to reset your dashboard
|
||||||
preferences (assuming a MySQL backend)::
|
preferences (assuming a MySQL backend, the truncate command also works in postgress)::
|
||||||
|
|
||||||
python manage dbshell
|
python manage.py dbshell
|
||||||
mysql> truncate admin_tools_dashboard_preferences;
|
mysql> truncate admin_tools_dashboard_preferences;
|
||||||
|
|
||||||
For more information see `this issue
|
For more information see `this issue
|
||||||
|
|
|
@ -8,7 +8,13 @@ Requirements
|
||||||
|
|
||||||
Before installing django-admin-tools, you'll need to have a copy of
|
Before installing django-admin-tools, you'll need to have a copy of
|
||||||
`Django <http://www.djangoproject.com>`_ already installed. For the
|
`Django <http://www.djangoproject.com>`_ already installed. For the
|
||||||
|version| release, Django 1.3 or newer is required.
|
|version| release, Django 1.7 or newer is required.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
*Important note to users of django 1.6 or below:*
|
||||||
|
starting from 0.6.0, django-admin-tools is *NOT* compatible with
|
||||||
|
django <= 1.6. If you want, you can still use the 0.5.2 version
|
||||||
|
that will always be available on Pypi.
|
||||||
|
|
||||||
For further information, consult the `Django download page
|
For further information, consult the `Django download page
|
||||||
<http://www.djangoproject.com/download/>`_, which offers convenient
|
<http://www.djangoproject.com/download/>`_, which offers convenient
|
||||||
|
@ -95,19 +101,17 @@ installation script. From a command line in that directory, type::
|
||||||
privileges (e.g., ``sudo python setup.py install``).
|
privileges (e.g., ``sudo python setup.py install``).
|
||||||
|
|
||||||
|
|
||||||
Manual installation from a Mercurial checkout
|
Manual installation from a git checkout
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
If you'd like to try out the latest in-development code, you can
|
If you'd like to try out the latest in-development code, you can
|
||||||
obtain it from the django-admin-tools repository, which is hosted at
|
obtain it from the django-admin-tools repository, which is hosted on
|
||||||
`Bitbucket <http://bitbucket.org/>`_ and uses `Mercurial
|
`Github <https://github.com/django-admin-tools/django-admin-tools>`_.
|
||||||
<http://www.selenic.com/mercurial/wiki/>`_ for version control. To
|
To obtain the latest code and documentation, you'll need to have
|
||||||
obtain the latest code and documentation, you'll need to have
|
Git installed, at which point you can type::
|
||||||
Mercurial installed, at which point you can type::
|
|
||||||
|
|
||||||
hg clone http://bitbucket.org/izi/django-admin-tools/
|
git clone https://github.com/django-admin-tools/django-admin-tools.git
|
||||||
|
|
||||||
This will create a copy of the django-admin-tools Mercurial repository
|
This will create a copy of the django-admin-tools Git repository on your
|
||||||
on your computer; you can then add the ``django-admin-tools`` directory
|
computer; you can then add the ``django-admin-tools`` directory to your
|
||||||
to your Python import path, or use the ``setup.py`` script to install
|
Python import path, or use the ``setup.py`` script to install as a package.
|
||||||
as a package.
|
|
||||||
|
|
|
@ -8,17 +8,10 @@ Introduction
|
||||||
|
|
||||||
Django supports custom admin sites, and of course you can have as many
|
Django supports custom admin sites, and of course you can have as many
|
||||||
admin sites as you want, django-admin-tools provides basic support for
|
admin sites as you want, django-admin-tools provides basic support for
|
||||||
this, you can setup a custom dashboard for each admin site.
|
this, you can setup a custom dashboard or menu for each admin site.
|
||||||
|
|
||||||
.. note::
|
Setting up a different dashboard and menu for each admin site instance
|
||||||
Multiple admin site support in django-admin-tools is, at the moment,
|
----------------------------------------------------------------------
|
||||||
limited to dashboards. This means you cannot have different menus or
|
|
||||||
theming for each instance of admin sites. This will change in the near
|
|
||||||
near future though.
|
|
||||||
|
|
||||||
|
|
||||||
Setting up a different dashboard for each admin site instance
|
|
||||||
-------------------------------------------------------------
|
|
||||||
|
|
||||||
In the following example we will assume that you have two admin site
|
In the following example we will assume that you have two admin site
|
||||||
instances: the default django admin site and a custom admin site of your
|
instances: the default django admin site and a custom admin site of your
|
||||||
|
@ -51,3 +44,16 @@ settings file::
|
||||||
|
|
||||||
Note that the same applies for the ``ADMIN_TOOLS_APP_INDEX_DASHBOARD``
|
Note that the same applies for the ``ADMIN_TOOLS_APP_INDEX_DASHBOARD``
|
||||||
settings variable.
|
settings variable.
|
||||||
|
|
||||||
|
Finally do the same thing for menu::
|
||||||
|
|
||||||
|
python manage.py custommenu django_admin_menu.py
|
||||||
|
python manage.py custommenu my_admin_menu.py
|
||||||
|
|
||||||
|
And to tell django-admin-tools to use your custom menu depending on
|
||||||
|
the admin site being used::
|
||||||
|
|
||||||
|
ADMIN_TOOLS_MENU = {
|
||||||
|
'django.contrib.admin.site': 'yourproject.django_admin_menu.CustomMenu',
|
||||||
|
'yourproject.admin.admin_site': 'yourproject.my_admin_menu.CustomMenu',
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,13 @@ Quick start guide
|
||||||
|
|
||||||
Before installing django-admin-tools, you'll need to have a copy of
|
Before installing django-admin-tools, you'll need to have a copy of
|
||||||
`Django <http://www.djangoproject.com>`_ already installed. For the
|
`Django <http://www.djangoproject.com>`_ already installed. For the
|
||||||
|version| release, Django 1.3 or newer is required.
|
|version| release, Django 1.7 or newer is required.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
*Important note to users of django 1.6 or below:*
|
||||||
|
starting from 0.6.0, django-admin-tools is *NOT* compatible with
|
||||||
|
django <= 1.6. If you want, you can still use the 0.5.2 version
|
||||||
|
that will always be available on Pypi.
|
||||||
|
|
||||||
|
|
||||||
Installing django-admin-tools
|
Installing django-admin-tools
|
||||||
|
@ -54,6 +60,12 @@ Configuration
|
||||||
First make sure you have the ``django.core.context_processors.request``
|
First make sure you have the ``django.core.context_processors.request``
|
||||||
template context processor in your ``TEMPLATE_CONTEXT_PROCESSORS``.
|
template context processor in your ``TEMPLATE_CONTEXT_PROCESSORS``.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Starting from django 1.8, ``TEMPLATE_CONTEXT_PROCESSORS`` is deprecated,
|
||||||
|
you must add the request context processor in your ``TEMPLATES`` variable
|
||||||
|
instead, please refer to the
|
||||||
|
`relevant django documentation <https://docs.djangoproject.com/en/1.8/ref/templates/upgrading/>`_.
|
||||||
|
|
||||||
Then, add admin_tools and its modules to the ``INSTALLED_APPS`` like this::
|
Then, add admin_tools and its modules to the ``INSTALLED_APPS`` like this::
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
|
@ -82,12 +94,7 @@ Then, just add django-admin-tools to your urls.py file::
|
||||||
|
|
||||||
Finally simply run::
|
Finally simply run::
|
||||||
|
|
||||||
python manage.py syncdb
|
python manage.py migrate
|
||||||
|
|
||||||
If you have South installed, make sure you run the following commands::
|
|
||||||
|
|
||||||
python manage.py migrate admin_tools.dashboard
|
|
||||||
python manage.py migrate admin_tools.menu
|
|
||||||
|
|
||||||
Testing your new shiny admin interface
|
Testing your new shiny admin interface
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
@ -99,4 +106,3 @@ changed.
|
||||||
django-admin-tools is fully customizable, but this is out of the scope of
|
django-admin-tools is fully customizable, but this is out of the scope of
|
||||||
this quickstart. To learn how to customize django-admin-tools modules
|
this quickstart. To learn how to customize django-admin-tools modules
|
||||||
please read :ref:`the customization section<customization>`.
|
please read :ref:`the customization section<customization>`.
|
||||||
|
|
||||||
|
|
|
@ -7,28 +7,14 @@ This is information for developers of django-admin-tools itself.
|
||||||
|
|
||||||
Running tests
|
Running tests
|
||||||
-------------
|
-------------
|
||||||
Run the `runtests.sh` script which is situated at the root dir of
|
|
||||||
django-admin-tools project.
|
|
||||||
|
|
||||||
Run all tests::
|
First, cd the test_proj directory::
|
||||||
|
|
||||||
$ ./runtests.sh
|
$ cd test_proj
|
||||||
|
|
||||||
Run only unit tests::
|
And to run the tests, just type::
|
||||||
|
|
||||||
$ ./runtests.sh unit
|
$ python manage.py test
|
||||||
|
|
||||||
Run only tests for specified app::
|
|
||||||
|
|
||||||
$ ./runtests.sh dashboard
|
|
||||||
|
|
||||||
Run only one test case::
|
|
||||||
|
|
||||||
$ ./runtests.sh dashboard.ManagementCommandTest
|
|
||||||
|
|
||||||
Run only one test::
|
|
||||||
|
|
||||||
$ ./runtests.sh dashboard.ManagementCommandTest.test_customdashboard
|
|
||||||
|
|
||||||
|
|
||||||
Code coverage report
|
Code coverage report
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
default_unit='admin_tools dashboard theming menu'
|
||||||
|
default_all="$default_unit test_app"
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
test_proj/manage.py test $default_all
|
||||||
|
else
|
||||||
|
if [ $1 = 'unit' ]
|
||||||
|
then
|
||||||
|
test_proj/manage.py test $default_unit
|
||||||
|
else
|
||||||
|
test_proj/manage.py test $*
|
||||||
|
fi
|
||||||
|
fi
|
|
@ -1,5 +1,2 @@
|
||||||
[egg_info]
|
[bdist_wheel]
|
||||||
tag_build =
|
universal = 1
|
||||||
tag_date = 0
|
|
||||||
tag_svn_revision = 0
|
|
||||||
|
|
||||||
|
|
15
setup.py
15
setup.py
|
@ -3,12 +3,12 @@
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from admin_tools import VERSION
|
from admin_tools import VERSION
|
||||||
|
|
||||||
bitbucket_url = 'http://bitbucket.org/izi/django-admin-tools/'
|
repo_url = 'https://github.com/django-admin-tools/django-admin-tools'
|
||||||
long_desc = '''
|
long_desc = '''
|
||||||
%s
|
%s
|
||||||
|
|
||||||
%s
|
%s
|
||||||
''' % (open('README').read(), open('CHANGELOG').read())
|
''' % (open('README.rst').read(), open('CHANGELOG').read())
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='django-admin-tools',
|
name='django-admin-tools',
|
||||||
|
@ -17,7 +17,7 @@ setup(
|
||||||
long_description=long_desc,
|
long_description=long_desc,
|
||||||
author='David Jean Louis',
|
author='David Jean Louis',
|
||||||
author_email='izimobil@gmail.com',
|
author_email='izimobil@gmail.com',
|
||||||
url=bitbucket_url,
|
url=repo_url,
|
||||||
download_url='https://pypi.python.org/packages/source/d/django-admin-tools/django-admin-tools-%s.tar.gz' % VERSION,
|
download_url='https://pypi.python.org/packages/source/d/django-admin-tools/django-admin-tools-%s.tar.gz' % VERSION,
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
@ -25,11 +25,16 @@ setup(
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
'Environment :: Web Environment',
|
'Environment :: Web Environment',
|
||||||
'Framework :: Django',
|
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'License :: OSI Approved :: MIT License',
|
'License :: OSI Approved :: MIT License',
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python :: 2',
|
||||||
|
'Programming Language :: Python :: 2.7',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.3',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Framework :: Django :: 1.7',
|
||||||
|
'Framework :: Django :: 1.8',
|
||||||
'Topic :: Software Development :: Libraries :: Python Modules'
|
'Topic :: Software Development :: Libraries :: Python Modules'
|
||||||
],
|
],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
|
|
|
@ -12,6 +12,12 @@ class CustomIndexDashboard(Dashboard):
|
||||||
"""
|
"""
|
||||||
Custom index dashboard for test_proj.
|
Custom index dashboard for test_proj.
|
||||||
"""
|
"""
|
||||||
|
class Media:
|
||||||
|
css = {
|
||||||
|
'all': ('test_app/dashboard.css',),
|
||||||
|
}
|
||||||
|
js = ('test_app/dashboard.js',)
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
Dashboard.__init__(self, **kwargs)
|
Dashboard.__init__(self, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,12 @@ class CustomMenu(Menu):
|
||||||
"""
|
"""
|
||||||
Custom Menu for test_proj admin site.
|
Custom Menu for test_proj admin site.
|
||||||
"""
|
"""
|
||||||
|
class Media:
|
||||||
|
css = {
|
||||||
|
'all': ('test_app/menu.css',),
|
||||||
|
}
|
||||||
|
js = ('test_app/menu.js',)
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
Menu.__init__(self, **kwargs)
|
Menu.__init__(self, **kwargs)
|
||||||
self.children += [
|
self.children += [
|
||||||
|
|
|
@ -86,13 +86,6 @@ STATICFILES_FINDERS = (
|
||||||
# Make this unique, and don't share it with anybody.
|
# Make this unique, and don't share it with anybody.
|
||||||
SECRET_KEY = 'django-admin-tools'
|
SECRET_KEY = 'django-admin-tools'
|
||||||
|
|
||||||
# List of callables that know how to import templates from various sources.
|
|
||||||
TEMPLATE_LOADERS = (
|
|
||||||
'django.template.loaders.filesystem.Loader',
|
|
||||||
'django.template.loaders.app_directories.Loader',
|
|
||||||
# 'django.template.loaders.eggs.Loader',
|
|
||||||
)
|
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
@ -108,30 +101,63 @@ ROOT_URLCONF = 'test_proj.urls'
|
||||||
# Python dotted path to the WSGI application used by Django's runserver.
|
# Python dotted path to the WSGI application used by Django's runserver.
|
||||||
WSGI_APPLICATION = 'test_proj.wsgi.application'
|
WSGI_APPLICATION = 'test_proj.wsgi.application'
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
import django
|
||||||
'django.contrib.auth.context_processors.auth',
|
from distutils.version import LooseVersion
|
||||||
'django.core.context_processors.debug',
|
version = django.get_version()
|
||||||
'django.core.context_processors.i18n',
|
use_older_syntax = LooseVersion(django.get_version()) < LooseVersion('1.8')
|
||||||
'django.core.context_processors.media',
|
if use_older_syntax:
|
||||||
'django.core.context_processors.static',
|
TEMPLATE_DIRS = (
|
||||||
'django.core.context_processors.request',
|
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||||
'django.contrib.messages.context_processors.messages',
|
# Always use forward slashes, even on Windows.
|
||||||
)
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
|
PROJECT_PATH + '/templates',
|
||||||
|
)
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
# List of callables that know how to import templates from various sources.
|
||||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
TEMPLATE_LOADERS = (
|
||||||
# Always use forward slashes, even on Windows.
|
'django.template.loaders.filesystem.Loader',
|
||||||
# Don't forget to use absolute paths, not relative paths.
|
'django.template.loaders.app_directories.Loader',
|
||||||
PROJECT_PATH + '/templates',
|
)
|
||||||
)
|
|
||||||
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.core.context_processors.debug',
|
||||||
|
'django.core.context_processors.i18n',
|
||||||
|
'django.core.context_processors.media',
|
||||||
|
'django.core.context_processors.static',
|
||||||
|
'django.core.context_processors.request',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [
|
||||||
|
PROJECT_PATH + '/templates',
|
||||||
|
# insert your TEMPLATE_DIRS here
|
||||||
|
],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.i18n',
|
||||||
|
'django.template.context_processors.media',
|
||||||
|
'django.template.context_processors.static',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.contenttypes',
|
||||||
'admin_tools',
|
'admin_tools',
|
||||||
'admin_tools.dashboard',
|
'admin_tools.dashboard',
|
||||||
'admin_tools.menu',
|
'admin_tools.menu',
|
||||||
'admin_tools.theming',
|
'admin_tools.theming',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
|
@ -140,7 +166,6 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
# Uncomment the next line to enable admin documentation:
|
# Uncomment the next line to enable admin documentation:
|
||||||
# 'django.contrib.admindocs',
|
# 'django.contrib.admindocs',
|
||||||
'south',
|
|
||||||
'test_app',
|
'test_app',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -149,7 +174,7 @@ try:
|
||||||
TEST_RUNNER = 'django_coverage.coverage_runner.CoverageRunner'
|
TEST_RUNNER = 'django_coverage.coverage_runner.CoverageRunner'
|
||||||
COVERAGE_REPORT_HTML_OUTPUT_DIR = os.path.join(PROJECT_PATH, '_coverage')
|
COVERAGE_REPORT_HTML_OUTPUT_DIR = os.path.join(PROJECT_PATH, '_coverage')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||||
|
|
||||||
|
|
||||||
ADMIN_TOOLS_INDEX_DASHBOARD = 'test_proj.dashboard.CustomIndexDashboard'
|
ADMIN_TOOLS_INDEX_DASHBOARD = 'test_proj.dashboard.CustomIndexDashboard'
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
404
|
|
@ -0,0 +1 @@
|
||||||
|
500
|
|
@ -0,0 +1,42 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"pk": 1,
|
||||||
|
"model": "auth.user",
|
||||||
|
"fields": {
|
||||||
|
"username": "superuser",
|
||||||
|
"first_name": "",
|
||||||
|
"last_name": "",
|
||||||
|
"is_active": true,
|
||||||
|
"is_superuser": true,
|
||||||
|
"is_staff": true,
|
||||||
|
"last_login": "2010-04-25 17:32:13",
|
||||||
|
"groups": [],
|
||||||
|
"user_permissions": [],
|
||||||
|
"password": "sha1$9efbf$da0bd72857bce1d486bd263b36482fa2fc82336d",
|
||||||
|
"email": "example@example.com",
|
||||||
|
"date_joined": "2009-10-30 03:17:26"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pk": 2,
|
||||||
|
"model": "auth.user",
|
||||||
|
"fields": {
|
||||||
|
"username": "staff",
|
||||||
|
"first_name": "",
|
||||||
|
"last_name": "",
|
||||||
|
"is_active": true,
|
||||||
|
"is_superuser": false,
|
||||||
|
"is_staff": true,
|
||||||
|
"last_login": "2010-04-25 17:33:01",
|
||||||
|
"groups": [],
|
||||||
|
"user_permissions": [
|
||||||
|
["add_bar", "test_app", "bar"],
|
||||||
|
["change_bar", "test_app", "bar"],
|
||||||
|
["delete_bar", "test_app", "bar"]
|
||||||
|
],
|
||||||
|
"password": "sha1$a7681$6721778bb4a3aff4c7b0b47c20c72afc1adf493d",
|
||||||
|
"email": "",
|
||||||
|
"date_joined": "2010-04-25 17:33:01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
/* dummy file for testing purpose */
|
|
@ -0,0 +1 @@
|
||||||
|
// dummy file for testing purpose
|
|
@ -0,0 +1 @@
|
||||||
|
/* dummy file for testing purpose */
|
|
@ -0,0 +1 @@
|
||||||
|
// dummy file for testing purpose
|
|
@ -3,7 +3,7 @@ import sys
|
||||||
|
|
||||||
class AdminBasicTest(TestCase):
|
class AdminBasicTest(TestCase):
|
||||||
|
|
||||||
fixtures = ['initial_data.json']
|
fixtures = ['users.json']
|
||||||
|
|
||||||
def test_admin_loads(self):
|
def test_admin_loads(self):
|
||||||
for (username, password) in (('superuser', '123'), ('staff', '123')):
|
for (username, password) in (('superuser', '123'), ('staff', '123')):
|
||||||
|
@ -13,6 +13,21 @@ class AdminBasicTest(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.client.logout()
|
self.client.logout()
|
||||||
|
|
||||||
|
|
||||||
|
def test_custom_menu_media(self):
|
||||||
|
self.client.login(username='superuser', password='123')
|
||||||
|
response = self.client.get('/admin/')
|
||||||
|
self.assertContains(response, '<link rel="stylesheet" href="/static/test_app/menu.css" type="text/css" media="all"/>')
|
||||||
|
self.assertContains(response, '/static/test_app/menu.js')
|
||||||
|
self.client.logout()
|
||||||
|
|
||||||
|
def test_custom_dashboard_media(self):
|
||||||
|
self.client.login(username='superuser', password='123')
|
||||||
|
response = self.client.get('/admin/')
|
||||||
|
self.assertContains(response, '<link rel="stylesheet" href="/static/test_app/dashboard.css" type="text/css" media="all"/>')
|
||||||
|
self.assertContains(response, '/static/test_app/dashboard.js')
|
||||||
|
self.client.logout()
|
||||||
|
|
||||||
def test_permissions(self):
|
def test_permissions(self):
|
||||||
self.client.login(username='staff', password='123')
|
self.client.login(username='staff', password='123')
|
||||||
index = self.client.get('/admin/')
|
index = self.client.get('/admin/')
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
[tox]
|
||||||
|
envlist = py27-dj17, py27-dj18, py33-dj17, py33-dj18
|
||||||
|
|
||||||
|
[testenv:py27-dj17]
|
||||||
|
basepython = python2.7
|
||||||
|
deps =
|
||||||
|
django==1.7.8
|
||||||
|
|
||||||
|
[testenv:py27-dj18]
|
||||||
|
basepython = python2.7
|
||||||
|
deps =
|
||||||
|
django==1.8.2
|
||||||
|
|
||||||
|
[testenv:py33-dj17]
|
||||||
|
basepython = python3.3
|
||||||
|
deps =
|
||||||
|
django==1.7.8
|
||||||
|
|
||||||
|
[testenv:py33-dj18]
|
||||||
|
basepython = python3.3
|
||||||
|
deps =
|
||||||
|
django==1.8.2
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
commands =
|
||||||
|
python -V
|
||||||
|
python test_proj/manage.py test
|
Loading…
Reference in New Issue