Compare commits

...

18 Commits

Author SHA1 Message Date
Fabio Caccamo e57042b1b4 Fixed README.rst badges [ci skip] 2017-09-29 15:26:40 +02:00
Fabio Caccamo 0b0eff8653 Updated version 2017-09-29 15:11:32 +02:00
Fabio Caccamo f6cef18c6b Updated README.rst for pypi 2017-09-29 15:11:18 +02:00
Fabio Caccamo e8522fe3d7 Updated version 2017-09-29 12:25:29 +02:00
Fabio Caccamo fcb8a38e50 Generate long_description in rst (reStructured Text) format on the fly using pandoc. 2017-09-29 12:25:15 +02:00
Fabio Caccamo 6c3a645edd Replaced repeated strings with variables 2017-09-29 12:24:02 +02:00
Fabio Caccamo b9d0ac6dab Updated django-flat-responsive version range. 2017-09-29 12:22:16 +02:00
Fabio Caccamo 3f270b0b75 Removed README.rst 2017-09-29 12:19:43 +02:00
Fabio Caccamo 7bc15ba61e Removed unused context argument 2017-09-29 12:12:44 +02:00
Fabio Caccamo 37bb3ce0df Removed unused arguments and variables 2017-09-29 12:12:01 +02:00
Fabio Caccamo 66b0172195 Removed unused import 2017-09-29 12:11:40 +02:00
Fabio Caccamo ca2f5c549e Fixed inlines style 2017-09-29 12:11:02 +02:00
Fabio Caccamo 21b221f9e9 Removed unused templatetag 2017-09-27 14:58:42 +02:00
Fabio Caccamo 5fcbef3c5b Merge branch 'master' of https://github.com/fabiocaccamo/django-admin-interface 2017-09-27 14:50:41 +02:00
Fabio Caccamo bc9d200461 Added README.rst to MANIFEST.in 2017-09-27 14:47:42 +02:00
Fabio Caccamo 8c903d5f4c Updated version 2017-09-27 14:47:14 +02:00
Fabio Caccamo c253617346 Updated Python code to be PEP8 compliant 2017-09-27 14:47:03 +02:00
Fabio Caccamo ca2b405989 Updated README.rst 2017-09-27 14:37:18 +02:00
13 changed files with 256 additions and 189 deletions
+7 -11
View File
@@ -13,7 +13,7 @@ django-admin-interface is a modern **responsive flat admin interface customizabl
- 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)*
- `NEW` **Related modal** *(instead of the old popup window, optional)*
- Style optimizations for: `django-ckeditor`, `django-modeltranslation`, `sorl-thumbnail`
## Requirements
@@ -41,7 +41,7 @@ INSTALLED_APPS = (
#### 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 migrate`` *(add* ``--fake-initial`` *if you are upgrading from 0.1.0 version)*
- Run ``python manage.py collectstatic --clear``
- Restart your application server
@@ -51,10 +51,10 @@ This package ships with optional themes as fixtures, they can be installed using
##### [Django](https://www.djangoproject.com/) theme (default):
Run ``python manage.py loaddata admin_interface_theme_django.json``
##### [Bootstrap](http://getbootstrap.com/) theme:
##### [Bootstrap](http://getbootstrap.com/) theme:
Run ``python manage.py loaddata admin_interface_theme_bootstrap.json``
##### [Foundation](http://foundation.zurb.com/) theme:
##### [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:
@@ -63,10 +63,10 @@ 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:
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)*.
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)*.
@@ -88,13 +88,9 @@ You can add a theme you've created through the admin to this repository by [send
## FAQ
- #### 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`
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).
+59 -98
View File
@@ -1,5 +1,4 @@
|Build Status| |codecov| |Code Health| |PyPI version| |Py versions|
|License|
|Build Status| |codecov| |Code Health| |PyPI version| |Py versions| |License|
django-admin-interface
======================
@@ -10,102 +9,75 @@ 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``
- 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
- 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
- Run ``pip install django-admin-interface``
- Add ``admin_interface``, ``flat_responsive``, ``flat`` *(only if django version < 1.9)* and ``colorfield`` to ``settings.INSTALLED_APPS`` **before** ``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
- 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>`__.
installed using the ``loaddata`` admin command.
Optional themes are activated on installation.
`Django <https://www.djangoproject.com/>`__ theme (default):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Django theme** (default):
Run ``python manage.py loaddata admin_interface_theme_django.json``
`Bootstrap <http://getbootstrap.com/>`__ theme:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Bootstrap theme**:
Run ``python manage.py loaddata admin_interface_theme_bootstrap.json``
`Foundation <http://foundation.zurb.com/>`__ theme:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Foundation theme**:
Run ``python manage.py loaddata admin_interface_theme_foundation.json``
`U.S. Web Design Standards <https://standards.usa.gov/>`__ theme:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**U.S. Web Design Standards 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 :
by **sending us a PR**. 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``
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)*.
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)*.
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.
@@ -113,69 +85,58 @@ Screenshots
-----------
Admin login
~~~~~~~~~~~
|django-admin-interface\_login|
|django-admin-interface_login|
-------------------------------
Admin dashboard
~~~~~~~~~~~~~~~
|django-admin-interface\_dashboard|
|django-admin-interface_dashboard|
-----------------------------------
Admin themes management
~~~~~~~~~~~~~~~~~~~~~~~
|django-admin-interface\_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
|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
**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/>`__
You can use ``django-apptemplates`, then add ``{% extends "admin_interface:admin/base_site.html" %}`` to your ``base_site.html``
License
-------
Released under `MIT License <LICENSE>`__.
Released under **MIT 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
.. |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
.. |django-admin-interface_theme_customization| image:: https://cloud.githubusercontent.com/assets/1035294/11240250/7350d942-8df1-11e5-9b28-f2f54c333cdc.gif
-3
View File
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from admin_interface.version import __version__
default_app_config = 'admin_interface.apps.AdminInterfaceConfig'
+43 -9
View File
@@ -17,7 +17,11 @@ class ThemeAdmin(admin.ModelAdmin):
}),
('Logo', {
'classes': ('wide', ),
'fields': ('logo', 'logo_color', 'logo_visible', )
'fields': (
'logo',
'logo_color',
'logo_visible',
)
}),
('Favicon', {
'classes': ('wide', ),
@@ -25,31 +29,62 @@ class ThemeAdmin(admin.ModelAdmin):
}),
('Title', {
'classes': ('wide', ),
'fields': ('title', 'title_color', 'title_visible', )
'fields': (
'title',
'title_color',
'title_visible',
)
}),
('Header', {
'classes': ('wide', ),
'fields': ('css_header_background_color', 'css_header_text_color', 'css_header_link_color', 'css_header_link_hover_color', )
'fields': (
'css_header_background_color',
'css_header_text_color',
'css_header_link_color',
'css_header_link_hover_color',
)
}),
('Breadcrumbs / Module headers', {
'classes': ('wide', ),
'fields': ('css_module_background_color', 'css_module_text_color', 'css_module_link_color', 'css_module_link_hover_color', 'css_module_rounded_corners', )
'fields': (
'css_module_background_color',
'css_module_text_color',
'css_module_link_color',
'css_module_link_hover_color',
'css_module_rounded_corners',
)
}),
('Generic Links', {
'classes': ('wide', ),
'fields': ('css_generic_link_color', 'css_generic_link_hover_color', )
'fields': (
'css_generic_link_color',
'css_generic_link_hover_color',
)
}),
('Save Buttons', {
'classes': ('wide', ),
'fields': ('css_save_button_background_color', 'css_save_button_background_hover_color', 'css_save_button_text_color', )
'fields': (
'css_save_button_background_color',
'css_save_button_background_hover_color',
'css_save_button_text_color',
)
}),
('Delete Buttons', {
'classes': ('wide', ),
'fields': ('css_delete_button_background_color', 'css_delete_button_background_hover_color', 'css_delete_button_text_color', )
'fields': (
'css_delete_button_background_color',
'css_delete_button_background_hover_color',
'css_delete_button_text_color',
)
}),
('Related Modal', {
'classes': ('wide', ),
'fields': ('related_modal_active', 'related_modal_background_color', 'related_modal_background_opacity', 'related_modal_rounded_corners', )
'fields': (
'related_modal_active',
'related_modal_background_color',
'related_modal_background_opacity',
'related_modal_rounded_corners',
)
}),
('List Filter', {
'classes': ('wide', ),
@@ -64,4 +99,3 @@ class ThemeAdmin(admin.ModelAdmin):
save_on_top = True
admin.site.register(Theme, ThemeAdmin)
+2 -1
View File
@@ -12,5 +12,6 @@ class AdminInterfaceConfig(AppConfig):
def ready(self):
from admin_interface.models import Theme
post_migrate.connect(Theme.post_migrate_handler, sender = self)
post_migrate.connect(
Theme.post_migrate_handler, sender=self)
+95 -44
View File
@@ -13,29 +13,29 @@ from colorfield.fields import ColorField
class Theme(models.Model):
@staticmethod
def post_migrate_handler(sender, **kwargs):
def post_migrate_handler(**kwargs):
Theme.get_active_theme()
@staticmethod
def post_delete_handler(instance, **kwargs):
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 )
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():
objs_active_qs = Theme.objects.filter( active = True )
objs_active_qs = Theme.objects.filter(active=True)
objs_active_ls = list(objs_active_qs)
objs_active_count = len(objs_active_ls)
if objs_active_count == 0:
default_obj, default_obj_created = Theme.objects.get_or_create(pk = '1', defaults = { 'active':True })
default_obj, default_obj_created = Theme.objects.get_or_create(
pk='1', defaults={'active': True})
if not default_obj_created:
default_obj.set_active()
obj = default_obj
@@ -49,45 +49,92 @@ class Theme(models.Model):
return obj
name = models.CharField( max_length = 50, default = 'Django' )
active = models.BooleanField( default = True )
name = models.CharField(max_length=50, default='Django')
active = models.BooleanField(default=True)
title = models.CharField( max_length = 50, default = 'Django administration', blank = True )
title_color = ColorField( blank = True, default = '#F5DD5D', help_text = '#F5DD5D', max_length = 10, verbose_name = 'title color' )
title_visible = models.BooleanField( default = True, verbose_name = 'visible' )
title = models.CharField(
max_length=50, default='Django administration', blank=True)
title_color = ColorField(
blank=True, default='#F5DD5D', help_text='#F5DD5D',
max_length=10, verbose_name='title color')
title_visible = models.BooleanField(
default=True, verbose_name='visible')
logo = models.FileField( upload_to = 'admin-interface/logo/', blank = True, help_text = '(leave blank to use the default Django logo)' )
logo_color = ColorField( blank = True, default = '#FFFFFF', help_text = '#FFFFFF', max_length = 10, verbose_name = 'logo color' )
logo_visible = models.BooleanField( default = True, verbose_name = 'visible' )
logo = models.FileField(
upload_to='admin-interface/logo/', blank=True,
help_text='(leave blank to use the default Django logo)')
logo_color = ColorField(
blank=True, default='#FFFFFF', help_text='#FFFFFF',
max_length=10, verbose_name='logo color')
logo_visible = models.BooleanField(
default=True, verbose_name='visible')
favicon = models.FileField( upload_to = 'admin-interface/favicon/', blank = True, help_text = '(.ico|.png|.gif - 16x16|32x32 px)', verbose_name = 'favicon' )
favicon = models.FileField(
upload_to='admin-interface/favicon/', blank=True,
help_text='(.ico|.png|.gif - 16x16|32x32 px)', verbose_name='favicon')
css_header_background_color = ColorField( blank = True, default = '#0C4B33', help_text = '#0C4B33', max_length = 10, verbose_name = 'background color' )
css_header_text_color = ColorField( blank = True, default = '#44B78B', help_text = '#44B78B', max_length = 10, verbose_name = 'text color' )
css_header_link_color = ColorField( blank = True, default = '#FFFFFF', help_text = '#FFFFFF', max_length = 10, verbose_name = 'link color' )
css_header_link_hover_color = ColorField( blank = True, default = '#C9F0DD', help_text = '#C9F0DD', max_length = 10, verbose_name = 'link hover color' )
css_header_background_color = ColorField(
blank=True, default='#0C4B33', help_text='#0C4B33',
max_length=10, verbose_name='background color')
css_header_text_color = ColorField(
blank=True, default='#44B78B', help_text='#44B78B',
max_length=10, verbose_name='text color')
css_header_link_color = ColorField(
blank=True, default='#FFFFFF', help_text='#FFFFFF',
max_length=10, verbose_name='link color')
css_header_link_hover_color = ColorField(
blank=True, default='#C9F0DD', help_text='#C9F0DD',
max_length=10, verbose_name='link hover color')
css_module_background_color = ColorField( blank = True, default = '#44B78B', help_text = '#44B78B', max_length = 10, verbose_name = 'background color' )
css_module_text_color = ColorField( blank = True, default = '#FFFFFF', help_text = '#FFFFFF', max_length = 10, verbose_name = 'text color' )
css_module_link_color = ColorField( blank = True, default = '#FFFFFF', help_text = '#FFFFFF', max_length = 10, verbose_name = 'link color' )
css_module_link_hover_color = ColorField( blank = True, default = '#C9F0DD', help_text = '#C9F0DD', max_length = 10, verbose_name = 'link hover color' )
css_module_rounded_corners = models.BooleanField( default = True, verbose_name = 'rounded corners' )
css_module_background_color = ColorField(
blank=True, default='#44B78B', help_text='#44B78B',
max_length=10, verbose_name='background color')
css_module_text_color = ColorField(
blank=True, default='#FFFFFF', help_text='#FFFFFF',
max_length=10, verbose_name='text color')
css_module_link_color = ColorField(
blank=True, default='#FFFFFF', help_text='#FFFFFF',
max_length=10, verbose_name='link color')
css_module_link_hover_color = ColorField(
blank=True, default='#C9F0DD', help_text='#C9F0DD',
max_length=10, verbose_name='link hover color')
css_module_rounded_corners = models.BooleanField(
default=True, verbose_name='rounded corners')
css_generic_link_color = ColorField( blank = True, default = '#0C3C26', help_text = '#0C3C26', max_length = 10, verbose_name = 'link color' )
css_generic_link_hover_color = ColorField( blank = True, default = '#156641', help_text = '#156641', max_length = 10, verbose_name = 'link hover color' )
css_generic_link_color = ColorField(
blank=True, default='#0C3C26', help_text='#0C3C26',
max_length=10, verbose_name='link color')
css_generic_link_hover_color = ColorField(
blank=True, default='#156641', help_text='#156641',
max_length=10, verbose_name='link hover color')
css_save_button_background_color = ColorField( blank = True, default = '#0C4B33', help_text = '#0C4B33', max_length = 10, verbose_name = 'background color' )
css_save_button_background_hover_color = ColorField( blank = True, default = '#0C3C26', help_text = '#0C3C26', max_length = 10, verbose_name = 'background hover color' )
css_save_button_text_color = ColorField( blank = True, default = '#FFFFFF', help_text = '#FFFFFF', max_length = 10, verbose_name = 'text color' )
css_save_button_background_color = ColorField(
blank=True, default='#0C4B33', help_text='#0C4B33',
max_length=10, verbose_name='background color')
css_save_button_background_hover_color = ColorField(
blank=True, default='#0C3C26', help_text='#0C3C26',
max_length=10, verbose_name='background hover color')
css_save_button_text_color = ColorField(
blank=True, default='#FFFFFF', help_text='#FFFFFF',
max_length=10, verbose_name='text color')
css_delete_button_background_color = ColorField( blank = True, default = '#BA2121', help_text = '#BA2121', max_length = 10, verbose_name = 'background color' )
css_delete_button_background_hover_color = ColorField( blank = True, default = '#A41515', help_text = '#A41515', max_length = 10, verbose_name = 'background hover color' )
css_delete_button_text_color = ColorField( blank = True, default = '#FFFFFF', help_text = '#FFFFFF', max_length = 10, verbose_name = 'text color' )
css_delete_button_background_color = ColorField(
blank=True, default='#BA2121', help_text='#BA2121',
max_length=10, verbose_name='background color')
css_delete_button_background_hover_color = ColorField(
blank=True, default='#A41515', help_text='#A41515',
max_length=10, verbose_name='background hover color')
css_delete_button_text_color = ColorField(
blank=True, default='#FFFFFF', help_text='#FFFFFF',
max_length=10, verbose_name='text color')
css = models.TextField( blank = True )
css = models.TextField(blank=True)
related_modal_active = models.BooleanField( default = True, verbose_name = 'active' )
related_modal_background_color = ColorField( blank = True, default = '#000000', help_text = '#000000', max_length = 10, verbose_name = 'background color' )
related_modal_active = models.BooleanField(
default=True, verbose_name='active')
related_modal_background_color = ColorField(
blank=True, default='#000000', help_text='#000000',
max_length=10, verbose_name='background color')
related_modal_background_opacity_choices = (
(0.1, '10%', ),
(0.2, '20%', ),
@@ -99,11 +146,16 @@ class Theme(models.Model):
(0.8, '80%', ),
(0.9, '90%', ),
)
related_modal_background_opacity = models.FloatField( choices = related_modal_background_opacity_choices, default = 0.2, help_text = '20%', verbose_name = 'background opacity' )
related_modal_rounded_corners = models.BooleanField( default = True, verbose_name = 'rounded corners' )
related_modal_background_opacity = models.FloatField(
choices=related_modal_background_opacity_choices,
default=0.2, help_text='20%', verbose_name='background opacity')
related_modal_rounded_corners = models.BooleanField(
default=True, verbose_name='rounded corners')
list_filter_dropdown = models.BooleanField( default = False, verbose_name = 'use dropdown' )
recent_actions_visible = models.BooleanField( default = True, verbose_name = 'visible' )
list_filter_dropdown = models.BooleanField(
default=False, verbose_name='use dropdown')
recent_actions_visible = models.BooleanField(
default=True, verbose_name='visible')
def set_active(self):
@@ -121,6 +173,5 @@ class Theme(models.Model):
return force_text(self.name)
post_delete.connect(Theme.post_delete_handler, sender = Theme)
post_save.connect(Theme.post_save_handler, sender = Theme)
post_delete.connect(Theme.post_delete_handler, sender=Theme)
post_save.connect(Theme.post_save_handler, sender=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>
@@ -13,7 +13,7 @@ except AttributeError:
assignment_tag = register.simple_tag
@assignment_tag(takes_context = True)
@assignment_tag(takes_context=True)
def get_admin_interface_theme(context):
theme = None
@@ -31,7 +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 -2
View File
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
__version__ = '0.5.3'
__version__ = '0.5.6'
+1 -1
View File
@@ -1,2 +1,2 @@
[metadata]
description-file = README.rst
description-file = README.md
+20 -7
View File
@@ -1,25 +1,39 @@
#!/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')
long_description_file_path = os.path.join(package_path, 'README.rst')
long_description = ''
with open(long_description_file_path) as f:
long_description = f.read()
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 +59,3 @@ setup(
license='MIT',
test_suite='runtests.runtests'
)
+15 -7
View File
@@ -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):