Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e8522fe3d7 | |||
| fcb8a38e50 | |||
| 6c3a645edd | |||
| b9d0ac6dab | |||
| 3f270b0b75 | |||
| 7bc15ba61e | |||
| 37bb3ce0df | |||
| 66b0172195 | |||
| ca2f5c549e | |||
| 21b221f9e9 | |||
| 5fcbef3c5b | |||
| ca2b405989 |
@@ -1,5 +1,4 @@
|
||||
include LICENSE.txt
|
||||
include README.md
|
||||
include README.rst
|
||||
recursive-include admin_interface *
|
||||
recursive-exclude * *.pyc __pycache__ .DS_Store
|
||||
-181
@@ -1,181 +0,0 @@
|
||||
|Build Status| |codecov| |Code Health| |PyPI version| |Py versions|
|
||||
|License|
|
||||
|
||||
django-admin-interface
|
||||
======================
|
||||
|
||||
django-admin-interface is a modern **responsive flat admin interface
|
||||
customizable by the admin itself**.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Beautiful default **django-theme**
|
||||
- Themes management and customization *(you can **customize admin
|
||||
title, logo and colors**)*
|
||||
- Responsive
|
||||
- List filter dropdown *(optional)*
|
||||
- **``NEW``** **Related modal** *(instead of the old popup window,
|
||||
optional)*
|
||||
- Style optimizations for: ``django-ckeditor``,
|
||||
``django-modeltranslation``, ``sorl-thumbnail``
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
- Python 2.7, 3.4, 3.5, 3.6
|
||||
- Django 1.7, 1.8, 1.9, 1.10, 1.11
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
- Run ``pip install django-admin-interface``
|
||||
- Add ``admin_interface``, ``flat_responsive``, ``flat`` and
|
||||
``colorfield`` to ``settings.INSTALLED_APPS`` **before**
|
||||
``django.contrib.admin``
|
||||
|
||||
.. code:: python
|
||||
|
||||
INSTALLED_APPS = (
|
||||
#...
|
||||
'admin_interface',
|
||||
'flat_responsive',
|
||||
'flat', # only if django version < 1.9
|
||||
'colorfield',
|
||||
#...
|
||||
'django.contrib.admin',
|
||||
#...
|
||||
)
|
||||
|
||||
- Run ``python manage.py migrate``
|
||||
- Run ``python manage.py collectstatic``
|
||||
- Restart your application server
|
||||
|
||||
Upgrade
|
||||
~~~~~~~
|
||||
|
||||
- Run ``pip install django-admin-interface --upgrade``
|
||||
- Run ``python manage.py migrate`` *(add ``--fake-initial`` if you are
|
||||
upgrading from 0.1.0 version)*
|
||||
- Run ``python manage.py collectstatic --clear``
|
||||
- Restart your application server
|
||||
|
||||
Optional themes
|
||||
---------------
|
||||
|
||||
This package ships with optional themes as fixtures, they can be
|
||||
installed using the `loaddata admin
|
||||
command <https://docs.djangoproject.com/en/1.11/ref/django-admin/#django-admin-loaddata>`__.
|
||||
Optional themes are activated on installation.
|
||||
|
||||
`Django <https://www.djangoproject.com/>`__ theme (default):
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Run ``python manage.py loaddata admin_interface_theme_django.json``
|
||||
|
||||
`Bootstrap <http://getbootstrap.com/>`__ theme:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Run ``python manage.py loaddata admin_interface_theme_bootstrap.json``
|
||||
|
||||
`Foundation <http://foundation.zurb.com/>`__ theme:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Run ``python manage.py loaddata admin_interface_theme_foundation.json``
|
||||
|
||||
`U.S. Web Design Standards <https://standards.usa.gov/>`__ theme:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Run ``python manage.py loaddata admin_interface_theme_uswds.json``
|
||||
|
||||
Add more themes
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
You can add a theme you've created through the admin to this repository
|
||||
by `sending us a PR <http://makeapullrequest.com/>`__. Here are the
|
||||
steps to follow to add :
|
||||
|
||||
1. Export your exact theme as fixture using the ``dumpdata`` admin
|
||||
command:
|
||||
``python manage.py dumpdata admin_interface.Theme --indent 4 -o admin_interface_theme_{{name}}.json --pks=N``
|
||||
|
||||
2. Copy the generated json file into the fixtures folder *(making sure
|
||||
its name starts with ``admin_interface_theme_`` to avoid clashes with
|
||||
fixtures that might be provided by other third party apps)*.
|
||||
|
||||
3. Remove the ``"pk"`` from the fixture and make sure the ``active``
|
||||
field is set to ``true`` *(in this way a theme is automatically
|
||||
activated when installed)*.
|
||||
|
||||
4. Edit the section above to document your theme.
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
Admin login
|
||||
~~~~~~~~~~~
|
||||
|
||||
|django-admin-interface\_login|
|
||||
-------------------------------
|
||||
|
||||
Admin dashboard
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|django-admin-interface\_dashboard|
|
||||
-----------------------------------
|
||||
|
||||
Admin themes management
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|django-admin-interface\_themes\_management|
|
||||
--------------------------------------------
|
||||
|
||||
Admin theme customization
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. figure:: https://cloud.githubusercontent.com/assets/1035294/11240250/7350d942-8df1-11e5-9b28-f2f54c333cdc.gif
|
||||
:alt: django-admin-interface\_theme\_customization
|
||||
|
||||
django-admin-interface\_theme\_customization
|
||||
|
||||
FAQ
|
||||
---
|
||||
|
||||
- .. rubric:: I already have a custom ``base_site.html``, how can I
|
||||
make it work?
|
||||
:name: i-already-have-a-custom-base_site.html-how-can-i-make-it-work
|
||||
|
||||
You can use
|
||||
`django-apptemplates <https://github.com/bittner/django-apptemplates>`__,
|
||||
then add **``{% extends "admin_interface:admin/base_site.html" %}``** to
|
||||
your ``base_site.html``
|
||||
|
||||
--------------
|
||||
|
||||
Thanks
|
||||
~~~~~~
|
||||
|
||||
- `django-flat-theme <https://github.com/elky/django-flat-theme/>`__
|
||||
- `django-flat-responsive <https://github.com/elky/django-flat-responsive>`__
|
||||
- `django-colorfield <https://github.com/jaredly/django-colorfield/>`__
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Released under `MIT License <LICENSE>`__.
|
||||
|
||||
.. |Build Status| image:: https://travis-ci.org/fabiocaccamo/django-admin-interface.svg?branch=master
|
||||
:target: https://travis-ci.org/fabiocaccamo/django-admin-interface
|
||||
.. |codecov| image:: https://codecov.io/gh/fabiocaccamo/django-admin-interface/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/fabiocaccamo/django-admin-interface
|
||||
.. |Code Health| image:: https://landscape.io/github/fabiocaccamo/django-admin-interface/master/landscape.svg?style=flat
|
||||
:target: https://landscape.io/github/fabiocaccamo/django-admin-interface/master
|
||||
.. |PyPI version| image:: https://badge.fury.io/py/django-admin-interface.svg
|
||||
:target: https://badge.fury.io/py/django-admin-interface
|
||||
.. |Py versions| image:: https://img.shields.io/pypi/pyversions/django-admin-interface.svg
|
||||
:target: https://img.shields.io/pypi/pyversions/django-admin-interface.svg
|
||||
.. |License| image:: https://img.shields.io/pypi/l/django-admin-interface.svg
|
||||
:target: https://img.shields.io/pypi/l/django-admin-interface.svg
|
||||
.. |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\_themes\_management| image:: https://cloud.githubusercontent.com/assets/1035294/11240245/6cd1c342-8df1-11e5-928b-f22217474d3d.gif
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from admin_interface.version import __version__
|
||||
|
||||
default_app_config = 'admin_interface.apps.AdminInterfaceConfig'
|
||||
|
||||
@@ -13,19 +13,18 @@ from colorfield.fields import ColorField
|
||||
class Theme(models.Model):
|
||||
|
||||
@staticmethod
|
||||
def post_migrate_handler(sender, **kwargs):
|
||||
theme = Theme.get_active_theme()
|
||||
def post_migrate_handler(**kwargs):
|
||||
Theme.get_active_theme()
|
||||
|
||||
@staticmethod
|
||||
def post_delete_handler(instance, **kwargs):
|
||||
theme = Theme.get_active_theme()
|
||||
def post_delete_handler(**kwargs):
|
||||
Theme.get_active_theme()
|
||||
|
||||
@staticmethod
|
||||
def post_save_handler(instance, created, **kwargs):
|
||||
theme = instance
|
||||
if theme.active:
|
||||
Theme.objects.exclude(pk=theme.pk).update(active=False)
|
||||
theme = Theme.get_active_theme()
|
||||
def post_save_handler(instance, **kwargs):
|
||||
if instance.active:
|
||||
Theme.objects.exclude(pk=instance.pk).update(active=False)
|
||||
Theme.get_active_theme()
|
||||
|
||||
@staticmethod
|
||||
def get_active_theme():
|
||||
|
||||
@@ -238,9 +238,17 @@ body.admin-interface .paginator a.showall:visited {
|
||||
}
|
||||
/* end fix */
|
||||
|
||||
.admin-interface .inline-group {
|
||||
/* begin fix restrict tabular-inline horizontal-scroll to inline-group instead of whole page */
|
||||
.admin-interface .inline-group[data-inline-type="tabular"] {
|
||||
overflow-x:auto;
|
||||
}
|
||||
/* end fix */
|
||||
|
||||
/* begin fix stacked-inline margin-bottom in responsive small viewport */
|
||||
.admin-interface .inline-group[data-inline-type="stacked"] .module {
|
||||
margin-bottom:0px;
|
||||
}
|
||||
/* end fix */
|
||||
|
||||
/* begin fix issue #10 - Related widget broken in long tabular inline */
|
||||
.admin-interface .inline-group .tabular .related-widget-wrapper {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% load i18n admin_interface_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
<div class="list-filter-dropdown">
|
||||
<h3>{% blocktrans with title as filter_title %} By {{ filter_title }} {% endblocktrans %}</h3>
|
||||
|
||||
@@ -31,6 +31,6 @@ def get_admin_interface_theme(context):
|
||||
return theme
|
||||
|
||||
|
||||
@assignment_tag(takes_context=True)
|
||||
def get_admin_interface_version(context):
|
||||
@assignment_tag(takes_context=False)
|
||||
def get_admin_interface_version():
|
||||
return __version__
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__version__ = '0.5.4'
|
||||
__version__ = '0.5.5'
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[metadata]
|
||||
description-file = README.rst
|
||||
description-file = README.md
|
||||
@@ -1,25 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
import os
|
||||
import pypandoc
|
||||
|
||||
exec(open('admin_interface/version.py').read())
|
||||
|
||||
github_url = 'https://github.com/fabiocaccamo'
|
||||
package_name = 'django-admin-interface'
|
||||
package_path = os.path.abspath(os.path.dirname(__file__))
|
||||
long_description = pypandoc.convert(os.path.join(package_path, 'README.md'), 'rst')
|
||||
|
||||
setup(
|
||||
name='django-admin-interface',
|
||||
name=package_name,
|
||||
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
|
||||
include_package_data=True,
|
||||
version=__version__,
|
||||
description='django-admin-interface is a modern responsive flat admin interface customizable by the admin itself.',
|
||||
long_description=long_description,
|
||||
author='Fabio Caccamo',
|
||||
author_email='fabio.caccamo@gmail.com',
|
||||
url='https://github.com/fabiocaccamo/django-admin-interface',
|
||||
download_url='https://github.com/fabiocaccamo/django-admin-interface/archive/%s.tar.gz' % __version__,
|
||||
url='%s/%s' % (github_url, package_name, ),
|
||||
download_url='%s/%s/archive/%s.tar.gz' % (github_url, package_name, __version__, ),
|
||||
keywords=['django', 'admin', 'interface', 'responsive', 'flat', 'theme', 'custom', 'ui'],
|
||||
requires=['django(>=1.7)'],
|
||||
install_requires=[
|
||||
'django-colorfield>=0.1,<1.0',
|
||||
'django-flat-theme>=1.0,<2.0',
|
||||
'django-flat-responsive>=1.0,<2.0',
|
||||
'django-colorfield >= 0.1, < 1.0',
|
||||
'django-flat-theme >= 1.0, < 2.0',
|
||||
'django-flat-responsive >= 1.0, < 3.0',
|
||||
],
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
@@ -45,4 +55,3 @@ setup(
|
||||
license='MIT',
|
||||
test_suite='runtests.runtests'
|
||||
)
|
||||
|
||||
|
||||
+15
-7
@@ -23,8 +23,8 @@ class AdminInterfaceTestCase(TestCase):
|
||||
shutil.rmtree(settings.MEDIA_ROOT, ignore_errors=True)
|
||||
pass
|
||||
|
||||
def __render_template(self, string, context):
|
||||
return Template(string).render(context)
|
||||
def __render_template(self, string, context=None):
|
||||
return Template(string).render(Context(context or {}))
|
||||
|
||||
def __test_active_theme(self):
|
||||
theme = Theme.get_active_theme()
|
||||
@@ -98,7 +98,10 @@ class AdminInterfaceTestCase(TestCase):
|
||||
context = Context({})
|
||||
theme = templatetags.get_admin_interface_theme(context)
|
||||
self.assertEqual(theme.name, 'Django')
|
||||
rendered = self.__render_template('{% load admin_interface_tags %}{% get_admin_interface_theme as theme %}{{ theme.name }}', context)
|
||||
rendered = self.__render_template(
|
||||
'{% load admin_interface_tags %}'\
|
||||
'{% get_admin_interface_theme as theme %}'\
|
||||
'{{ theme.name }}', context)
|
||||
self.assertEqual(rendered, 'Django')
|
||||
|
||||
def test_templatetags_get_theme_with_request(self):
|
||||
@@ -108,14 +111,19 @@ class AdminInterfaceTestCase(TestCase):
|
||||
})
|
||||
theme = templatetags.get_admin_interface_theme(context)
|
||||
self.assertEqual(theme.name, 'Django')
|
||||
rendered = self.__render_template('{% load admin_interface_tags %}{% get_admin_interface_theme as theme %}{{ theme.name }}', context)
|
||||
rendered = self.__render_template(
|
||||
'{% load admin_interface_tags %}'\
|
||||
'{% get_admin_interface_theme as theme %}'\
|
||||
'{{ theme.name }}', context)
|
||||
self.assertEqual(rendered, 'Django')
|
||||
|
||||
def test_templatetags_get_version(self):
|
||||
context = Context({})
|
||||
version = templatetags.get_admin_interface_version(context)
|
||||
version = templatetags.get_admin_interface_version()
|
||||
self.assertEqual(version, __version__)
|
||||
rendered = self.__render_template('{% load admin_interface_tags %}{% get_admin_interface_version as version %}{{ version }}', context)
|
||||
rendered = self.__render_template(
|
||||
'{% load admin_interface_tags %}'\
|
||||
'{% get_admin_interface_version as version %}'\
|
||||
'{{ version }}')
|
||||
self.assertEqual(rendered, __version__)
|
||||
|
||||
def test_repr(self):
|
||||
|
||||
Reference in New Issue
Block a user