Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e57042b1b4 | |||
| 0b0eff8653 | |||
| f6cef18c6b | |||
| e8522fe3d7 | |||
| fcb8a38e50 | |||
| 6c3a645edd | |||
| b9d0ac6dab | |||
| 3f270b0b75 | |||
| 7bc15ba61e | |||
| 37bb3ce0df | |||
| 66b0172195 | |||
| ca2f5c549e | |||
| 21b221f9e9 | |||
| 5fcbef3c5b | |||
| bc9d200461 | |||
| 8c903d5f4c | |||
| c253617346 | |||
| ca2b405989 | |||
| 0fd8469d9a | |||
| 5cce94eefc | |||
| c4c6a2b0f2 | |||
| 73a61080ae | |||
| 0164e5b791 | |||
| bb29c637ff | |||
| a8e9fffdac |
@@ -1,5 +1,6 @@
|
||||
[](https://travis-ci.org/fabiocaccamo/django-admin-interface)
|
||||
[](https://codecov.io/gh/fabiocaccamo/django-admin-interface)
|
||||
[](https://landscape.io/github/fabiocaccamo/django-admin-interface/master)
|
||||
[](https://badge.fury.io/py/django-admin-interface)
|
||||
[](https://img.shields.io/pypi/pyversions/django-admin-interface.svg)
|
||||
[](https://img.shields.io/pypi/l/django-admin-interface.svg)
|
||||
@@ -12,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
|
||||
@@ -40,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
|
||||
|
||||
@@ -50,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:
|
||||
@@ -62,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)*.
|
||||
|
||||
@@ -84,10 +85,12 @@ You can add a theme you've created through the admin to this repository by [send
|
||||
###### Admin theme customization
|
||||

|
||||
|
||||
#### 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/)
|
||||
## 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`
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
Released under [MIT License](LICENSE).
|
||||
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
|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`` *(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
|
||||
|
||||
Optional themes
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
This package ships with optional themes as fixtures, they can be
|
||||
installed using the ``loaddata`` admin command.
|
||||
Optional themes are activated on installation.
|
||||
|
||||
**Django theme** (default):
|
||||
|
||||
Run ``python manage.py loaddata admin_interface_theme_django.json``
|
||||
|
||||
**Bootstrap theme**:
|
||||
|
||||
Run ``python manage.py loaddata admin_interface_theme_bootstrap.json``
|
||||
|
||||
**Foundation theme**:
|
||||
|
||||
Run ``python manage.py loaddata admin_interface_theme_foundation.json``
|
||||
|
||||
**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**. 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
|
||||
|
||||
|
||||
|django-admin-interface_theme_customization|
|
||||
---------------------------------------------
|
||||
|
||||
FAQ
|
||||
---
|
||||
|
||||
**I already have a custom** ``base_site.html`` **, how can I make it work?**
|
||||
|
||||
You can use ``django-apptemplates`, then add ``{% extends "admin_interface:admin/base_site.html" %}`` to your ``base_site.html``
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Released under **MIT License**.
|
||||
|
||||
|
||||
.. |Build Status| image:: https://travis-ci.org/fabiocaccamo/django-admin-interface.svg?branch=master
|
||||
|
||||
.. |codecov| image:: https://codecov.io/gh/fabiocaccamo/django-admin-interface/branch/master/graph/badge.svg
|
||||
|
||||
.. |Code Health| image:: https://landscape.io/github/fabiocaccamo/django-admin-interface/master/landscape.svg?style=flat
|
||||
|
||||
.. |PyPI version| image:: https://badge.fury.io/py/django-admin-interface.svg
|
||||
|
||||
.. |Py versions| image:: https://img.shields.io/pypi/pyversions/django-admin-interface.svg
|
||||
|
||||
.. |License| image:: 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_theme_customization| image:: https://cloud.githubusercontent.com/assets/1035294/11240250/7350d942-8df1-11e5-9b28-f2f54c333cdc.gif
|
||||
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from admin_interface.version import __version__
|
||||
|
||||
default_app_config = 'admin_interface.apps.AdminInterfaceConfig'
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
@@ -78,14 +78,13 @@
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.admin-interface fieldset.collapse.collapsed a.collapse-toggle {
|
||||
font-weight: bold;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
.admin-interface fieldset.collapse.collapsed a.collapse-toggle,
|
||||
.admin-interface fieldset.collapse a.collapse-toggle {
|
||||
font-weight: bold;
|
||||
font-weight: normal;
|
||||
text-transform: lowercase;
|
||||
font-size: 12px;
|
||||
text-decoration: underline;
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -239,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 {
|
||||
|
||||
@@ -58,12 +58,12 @@
|
||||
}
|
||||
|
||||
.admin-interface fieldset.collapse.collapsed a.collapse-toggle {
|
||||
color:{{ theme.css_generic_link_color }};
|
||||
color:{{ theme.css_module_link_color }};
|
||||
}
|
||||
|
||||
.admin-interface fieldset.collapse.collapsed a.collapse-toggle:hover,
|
||||
.admin-interface fieldset.collapse.collapsed a.collapse-toggle:active {
|
||||
color:{{ theme.css_generic_link_hover_color }};
|
||||
color:{{ theme.css_module_link_hover_color }};
|
||||
}
|
||||
|
||||
.admin-interface fieldset.collapse a.collapse-toggle {
|
||||
|
||||
@@ -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,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__version__ = '0.5.2'
|
||||
|
||||
__version__ = '0.5.6'
|
||||
|
||||
@@ -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'
|
||||
)
|
||||
|
||||
|
||||
+26
-23
@@ -9,6 +9,7 @@ import random
|
||||
import shutil
|
||||
|
||||
from admin_interface.models import Theme
|
||||
from admin_interface.templatetags import admin_interface_tags as templatetags
|
||||
from admin_interface.version import __version__
|
||||
|
||||
|
||||
@@ -22,11 +23,10 @@ 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()
|
||||
print( theme )
|
||||
self.assertTrue(theme != None)
|
||||
@@ -34,17 +34,14 @@ class AdminInterfaceTestCase(TestCase):
|
||||
self.assertEqual(Theme.objects.filter( active = True ).count(), 1);
|
||||
|
||||
def test_default_theme_created_if_no_themes(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_default_theme_created_if_all_themes_deleted(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_default_theme_activated_on_save_if_no_active_themes(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
theme = Theme.get_active_theme()
|
||||
theme.active = False
|
||||
@@ -52,13 +49,11 @@ class AdminInterfaceTestCase(TestCase):
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_default_theme_activated_after_update_if_no_active_themes(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
Theme.objects.all().update( active = False )
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_default_theme_activated_after_update_if_multiple_active_themes(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
theme_1 = Theme.objects.create( name = 'Custom 1', active = True )
|
||||
theme_2 = Theme.objects.create( name = 'Custom 2', active = True )
|
||||
@@ -68,7 +63,6 @@ class AdminInterfaceTestCase(TestCase):
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_default_theme_activated_on_active_theme_deleted(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
theme_1 = Theme.objects.create( name = 'Custom 1', active = True )
|
||||
theme_2 = Theme.objects.create( name = 'Custom 2', active = True )
|
||||
@@ -77,7 +71,6 @@ class AdminInterfaceTestCase(TestCase):
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_last_theme_activated_on_multiple_themes_created(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
theme_1 = Theme.objects.create( name = 'Custom 1', active = True )
|
||||
theme_2 = Theme.objects.create( name = 'Custom 2', active = True )
|
||||
@@ -86,7 +79,6 @@ class AdminInterfaceTestCase(TestCase):
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_last_theme_activated_on_multiple_themes_activated(self):
|
||||
|
||||
Theme.objects.all().delete()
|
||||
theme_1 = Theme.objects.create( name = 'Custom 1', active = True )
|
||||
theme_2 = Theme.objects.create( name = 'Custom 2', active = True )
|
||||
@@ -101,28 +93,39 @@ class AdminInterfaceTestCase(TestCase):
|
||||
self.assertEqual( Theme.get_active_theme().pk, theme.pk )
|
||||
self.__test_active_theme()
|
||||
|
||||
def test_templatetags(self):
|
||||
|
||||
def test_templatetags_get_theme(self):
|
||||
Theme.objects.all().delete()
|
||||
context = Context({})
|
||||
rendered = self.__render_template('{% load admin_interface_tags %}{% get_admin_interface_theme as theme %}{{ theme.name }}', 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)
|
||||
self.assertEqual(rendered, 'Django')
|
||||
|
||||
def test_templatetags_version(self):
|
||||
|
||||
context = Context({})
|
||||
rendered = self.__render_template('{% load admin_interface_tags %}{% get_admin_interface_version as version %}{{ version }}', context)
|
||||
self.assertEqual(rendered, __version__)
|
||||
|
||||
def test_templatetags_with_request(self):
|
||||
|
||||
def test_templatetags_get_theme_with_request(self):
|
||||
Theme.objects.all().delete()
|
||||
context = Context({
|
||||
'request': self.request_factory.get('/')
|
||||
})
|
||||
rendered = self.__render_template('{% load admin_interface_tags %}{% get_admin_interface_theme as theme %}{{ theme.name }}', 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)
|
||||
self.assertEqual(rendered, 'Django')
|
||||
|
||||
def test_templatetags_get_version(self):
|
||||
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 }}')
|
||||
self.assertEqual(rendered, __version__)
|
||||
|
||||
def test_repr(self):
|
||||
theme = Theme.get_active_theme()
|
||||
self.assertEqual( '{0}'.format(theme), 'Django' )
|
||||
|
||||
Reference in New Issue
Block a user