Compare commits

...

32 Commits

Author SHA1 Message Date
Fabio Caccamo db7c12fdb4 Added CHANGELOG and updated version. [ci skip] 2019-05-09 11:26:03 +02:00
Fabio Caccamo 5b0a5e4c46 Merge pull request #62 from pooyamb/master
Fix #52: Broken migration on postgres/windows
2019-05-09 10:41:27 +02:00
Pouya Mobasher Behrouz 0f1dde545e Fix #52: Broken migration on postgres/windows 2019-05-07 18:44:00 +04:30
Fabio Caccamo b45e357418 Updated .travis 2019-04-29 18:44:29 +02:00
Fabio Caccamo fa6c79c367 Updated .travis 2019-04-29 18:37:34 +02:00
Fabio Caccamo 760609cafd Updated .travis 2019-04-29 18:27:26 +02:00
Fabio Caccamo cb3443aa4c Added django 2.2 to tox and travis and updated README. 2019-04-29 17:51:51 +02:00
Fabio Caccamo 9384c6db79 Updated version. 2019-04-29 17:36:47 +02:00
Fabio Caccamo 1a800d7d6a Fixed admin duplicated count query. 2019-04-29 17:36:36 +02:00
Fabio Caccamo 352701ae7d Added admin theme caching to remove duplicated queries. Fixed #19 2019-04-29 17:35:24 +02:00
Fabio Caccamo b4d0b4c985 Added django-dynamic-raw-id support - #61 2019-04-29 16:38:28 +02:00
Fabio Caccamo 26e67dab66 Updated app title italian localization. 2019-04-29 16:37:56 +02:00
Fabio Caccamo e604dcdffa Updated version [ci skip] 2019-03-28 12:15:30 +01:00
Fabio Caccamo 9b56343a81 Added idempotent deploy support. 2019-03-28 12:08:17 +01:00
Fabio Caccamo aef2d56fba Updated version. 2019-03-22 11:41:40 +01:00
Fabio Caccamo cb7a358c6c Fixed raw-id-field whith django-admin-interface #58 2019-03-22 11:41:31 +01:00
Fabio Caccamo c8690b316b Updated version. [ci skip] 2019-03-21 10:27:49 +01:00
Fabio Caccamo 91bba7f522 Merge pull request #57 from merwok-forks/master
Update French localization
2019-03-21 10:16:46 +01:00
Éric Araujo 439902dce8 fix typo 2019-03-20 14:15:39 -04:00
Éric Araujo 19854f70a3 update french localization 2019-03-20 14:14:44 -04:00
Fabio Caccamo 8291a65a15 Updated version [ci skip] 2019-03-20 17:58:20 +01:00
Fabio Caccamo 9433287cee Updated messages. 2019-03-20 17:53:25 +01:00
Fabio Caccamo f0a046ff7f Added related modal close button #45 2019-03-20 17:53:03 +01:00
Fabio Caccamo 877c4da5bf Updated fields verbose names. 2019-03-20 12:42:10 +01:00
Fabio Caccamo 229a4ef573 Updated README. [ci skip] 2019-03-20 12:34:29 +01:00
Fabio Caccamo cf5e784550 Updated messages. 2019-03-20 12:34:17 +01:00
Fabio Caccamo e58bbbeacf Added environment options - Fixed #56 2019-03-20 12:33:53 +01:00
Fabio Caccamo 1c2ac2a308 Updated version. [ci skip] 2019-02-21 18:05:09 +01:00
Fabio Caccamo 3133beb82f Enabled travis pip cache. 2019-02-21 17:30:13 +01:00
Fabio Caccamo 18d2281011 Splitted tests to multiple files. 2019-02-21 17:17:59 +01:00
Fabio Caccamo 7d9edddf82 Added env badge to favicon. 2019-02-21 17:16:48 +01:00
Fabio Caccamo 1c335f83e9 Added PyPi downloads badge to README. [ci skip] 2019-02-08 12:01:33 +01:00
34 changed files with 1711 additions and 351 deletions
+14
View File
@@ -1,4 +1,5 @@
language: python language: python
cache: pip
python: 3.5 python: 3.5
env: env:
- TOX_ENV=py27-dj17-sqlite - TOX_ENV=py27-dj17-sqlite
@@ -35,6 +36,8 @@ env:
- TOX_ENV=py35-dj20-postgres - TOX_ENV=py35-dj20-postgres
- TOX_ENV=py35-dj21-sqlite - TOX_ENV=py35-dj21-sqlite
- TOX_ENV=py35-dj21-postgres - TOX_ENV=py35-dj21-postgres
# - TOX_ENV=py35-dj22-sqlite
- TOX_ENV=py35-dj22-postgres
matrix: matrix:
include: include:
- python: "3.6" - python: "3.6"
@@ -49,6 +52,10 @@ matrix:
env: env:
- TOX_ENV=py36-dj21-sqlite - TOX_ENV=py36-dj21-sqlite
- TOX_ENV=py36-dj21-postgres - TOX_ENV=py36-dj21-postgres
- python: "3.6"
env:
- TOX_ENV=py36-dj22-sqlite
- TOX_ENV=py36-dj22-postgres
- python: "3.6" - python: "3.6"
env: env:
- TOX_ENV=py36-djmaster-sqlite - TOX_ENV=py36-djmaster-sqlite
@@ -67,6 +74,13 @@ matrix:
dist: xenial dist: xenial
language: python language: python
sudo: required sudo: required
- python: "3.7"
env:
- TOX_ENV=py37-dj22-sqlite
- TOX_ENV=py37-dj22-postgres
dist: xenial
language: python
sudo: required
- python: "3.7" - python: "3.7"
env: env:
- TOX_ENV=py37-djmaster-sqlite - TOX_ENV=py37-djmaster-sqlite
+146
View File
@@ -0,0 +1,146 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.5] - 2019-05-09
- Fixed broken migration on postgres/windows. #52
## [0.10.4] - 2019-03-29
- Added django 2.2 to tox and travis.
- Fixed admin duplicated count query.
- Added admin theme caching to remove duplicated queries. #19
- Added django-dynamic-raw-id support. #61
- Updated app title italian localization.
## [0.10.3] - 2019-03-28
- Fixed idempotent deploy support. #40
## [0.10.2] - 2019-03-22
- Fixed raw-id-field whith django-admin-interface. #58
## [0.10.1] - 2019-03-20
- Updated french localization.
## [0.10.0] - 2019-02-21
- Updated messages.
- Added related modal close button. #45
- Updated fields verbose names.
- Added environment options. #56
## [0.9.3] - 2019-02-06
- Enabled travis pip cache.
- Splitted tests to multiple files.
- Added env badge to favicon.
## [0.9.2] - 2019-01-11
- Fixed cancel button does not work. #53
- Fixed IntegrityError on postgres
## [0.9.1] - 2019-01-11
- Fixed missing migration. #51
## [0.9.0] - 2018-11-13
- Added French localization.
- Added Italian localization.
- Added Spanish localization.
- Added internationalization support.
## [0.8.2] - 2018-10-24
## [0.8.1] - 2018-10-11
## [0.8.0] - 2018-08-31
## [0.7.0] - 2018-02-06
## [0.6.3] - 2018-02-05
## [0.6.2] - 2018-02-01
## [0.6.1] - 2018-01-31
## [0.6.0] - 2017-11-23
## [0.5.9] - 2017-10-04
## [0.5.8] - 2017-09-29
## [0.5.7] - 2017-09-29
## [0.5.6] - 2017-09-29
## [0.5.5] - 2017-09-27
## [0.5.4] - 2017-09-27
## [0.5.3] - 2017-08-24
## [0.5.2] - 2017-07-13
## [0.5.1] - 2017-06-13
## [0.5.0] - 2017-06-09
## [0.4.6] - 2017-05-24
## [0.4.5] - 2017-05-19
## [0.4.4] - 2017-05-18
## [0.4.3] - 2017-05-16
## [0.4.2] - 2017-05-11
## [0.4.1] - 2017-05-04
## [0.4.0] - 2017-04-14
## [0.3.2] - 2017-03-29
## [0.3.1] - 2017-03-29
## [0.3.0] - 2017-02-09
## [0.2.1] - 2016-11-08
## [0.2.0] - 2016-09-10
## [0.1.9] - 2016-09-04
## [0.1.8] - 2016-08-05
## [0.1.7] - 2016-06-29
## [0.1.6] - 2016-04-13
## [0.1.5] - 2016-02-24
## [0.1.4] - 2016-02-15
## [0.1.3] - 2015-12-03
## [0.1.2] - 2015-11-25
## [0.1.1] - 2015-11-13
## [0.0.1] - 2015-11-13
### Added
- Added setup files to make the package installable using pip.
- Added ckeditor light skin.
- Added support to dropdown list filter.
- Added post_migrate handler to create the default theme after install.
[0.10.5]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.10.5
[0.10.4]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.10.4
[0.10.3]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.10.3
[0.10.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.10.2
[0.10.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.10.1
[0.10.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.10.0
[0.9.3]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.9.3
[0.9.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.9.2
[0.9.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.9.1
[0.9.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.9.0
[0.8.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.8.2
[0.8.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.8.1
[0.8.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.8.0
[0.7.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.7.0
[0.6.3]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.6.3
[0.6.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.6.2
[0.6.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.6.1
[0.6.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.6.0
[0.5.9]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.9
[0.5.8]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.8
[0.5.7]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.7
[0.5.6]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.6
[0.5.5]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.5
[0.5.4]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.4
[0.5.3]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.3
[0.5.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.2
[0.5.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.1
[0.5.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.5.0
[0.4.6]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.4.6
[0.4.5]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.4.5
[0.4.4]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.4.4
[0.4.3]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.4.3
[0.4.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.4.2
[0.4.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.4.1
[0.4.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.4.0
[0.3.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.3.2
[0.3.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.3.1
[0.3.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.3.0
[0.2.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.2.1
[0.2.0]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.2.0
[0.1.9]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.9
[0.1.8]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.8
[0.1.7]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.7
[0.1.6]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.6
[0.1.5]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.5
[0.1.4]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.4
[0.1.3]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.3
[0.1.2]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.2
[0.1.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.1.1
[0.0.1]: https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.0.1
+5 -3
View File
@@ -2,6 +2,7 @@
[![codecov](https://codecov.io/gh/fabiocaccamo/django-admin-interface/branch/master/graph/badge.svg)](https://codecov.io/gh/fabiocaccamo/django-admin-interface) [![codecov](https://codecov.io/gh/fabiocaccamo/django-admin-interface/branch/master/graph/badge.svg)](https://codecov.io/gh/fabiocaccamo/django-admin-interface)
[![Code Health](https://landscape.io/github/fabiocaccamo/django-admin-interface/master/landscape.svg?style=flat)](https://landscape.io/github/fabiocaccamo/django-admin-interface/master) [![Code Health](https://landscape.io/github/fabiocaccamo/django-admin-interface/master/landscape.svg?style=flat)](https://landscape.io/github/fabiocaccamo/django-admin-interface/master)
[![PyPI version](https://badge.fury.io/py/django-admin-interface.svg)](https://badge.fury.io/py/django-admin-interface) [![PyPI version](https://badge.fury.io/py/django-admin-interface.svg)](https://badge.fury.io/py/django-admin-interface)
[![PyPI downloads](https://img.shields.io/pypi/dm/django-admin-interface.svg)](https://img.shields.io/pypi/dm/django-admin-interface.svg)
[![Py versions](https://img.shields.io/pypi/pyversions/django-admin-interface.svg)](https://img.shields.io/pypi/pyversions/django-admin-interface.svg) [![Py versions](https://img.shields.io/pypi/pyversions/django-admin-interface.svg)](https://img.shields.io/pypi/pyversions/django-admin-interface.svg)
[![License](https://img.shields.io/pypi/l/django-admin-interface.svg)](https://img.shields.io/pypi/l/django-admin-interface.svg) [![License](https://img.shields.io/pypi/l/django-admin-interface.svg)](https://img.shields.io/pypi/l/django-admin-interface.svg)
@@ -16,16 +17,17 @@ django-admin-interface is a modern **responsive flat admin interface customizabl
- Responsive - Responsive
- List filter dropdown *(optional)* - List filter dropdown *(optional)*
- `NEW` **Related modal** *(instead of the old popup window, optional)* - `NEW` **Related modal** *(instead of the old popup window, optional)*
- `NEW` **Enviroment label** *(development, testing, staging, production)* - `NEW` **Environment name/marker**
- Style optimizations for: - Compatibility / Style optimizations for:
- `django-ckeditor` - `django-ckeditor`
- `django-dynamic-raw-id`
- `django-modeltranslation` - `django-modeltranslation`
- `django-tabbed-admin` - `django-tabbed-admin`
- `sorl-thumbnail` - `sorl-thumbnail`
## Requirements ## Requirements
- Python 2.7, 3.4, 3.5, 3.6, 3.7 - Python 2.7, 3.4, 3.5, 3.6, 3.7
- Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1 - Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1, 2.2
## Installation ## Installation
- Run `pip install django-admin-interface` - Run `pip install django-admin-interface`
+7 -4
View File
@@ -1,4 +1,4 @@
|Build Status| |codecov| |Code Health| |PyPI version| |Py versions| |License| |Build Status| |codecov| |Code Health| |PyPI version| |PyPI downloads| |Py versions| |License|
django-admin-interface django-admin-interface
====================== ======================
@@ -17,9 +17,10 @@ Features
- Responsive - Responsive
- List filter dropdown *(optional)* - List filter dropdown *(optional)*
- ``NEW`` **Related modal** (instead of the old popup window, optional) - ``NEW`` **Related modal** (instead of the old popup window, optional)
- ``NEW`` **Enviroment label** (development, testing, staging, production) - ``NEW`` **Environment name/marker**
- Style optimizations for: - Compatibility / Style optimizations for:
- `django-ckeditor` - `django-ckeditor`
- `django-dynamic-raw-id`
- `django-modeltranslation` - `django-modeltranslation`
- `django-tabbed-admin` - `django-tabbed-admin`
- `sorl-thumbnail` - `sorl-thumbnail`
@@ -28,7 +29,7 @@ Requirements
------------ ------------
- Python 2.7, 3.4, 3.5, 3.6, 3.7 - Python 2.7, 3.4, 3.5, 3.6, 3.7
- Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1 - Django 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1, 2.2
Installation Installation
------------ ------------
@@ -137,6 +138,8 @@ Released under **MIT License**.
.. |PyPI version| image:: https://badge.fury.io/py/django-admin-interface.svg .. |PyPI version| image:: https://badge.fury.io/py/django-admin-interface.svg
.. |PyPI downloads| image:: https://img.shields.io/pypi/dm/django-admin-interface.svg
.. |Py versions| image:: https://img.shields.io/pypi/pyversions/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 .. |License| image:: https://img.shields.io/pypi/l/django-admin-interface.svg
+7 -2
View File
@@ -10,6 +10,8 @@ class ThemeAdmin(admin.ModelAdmin):
list_display = ('name', 'active', ) list_display = ('name', 'active', )
list_editable = ('active', ) list_editable = ('active', )
list_per_page = 100
show_full_result_count = False
fieldsets = ( fieldsets = (
(None, { (None, {
@@ -19,8 +21,10 @@ class ThemeAdmin(admin.ModelAdmin):
(_('Environment'), { (_('Environment'), {
'classes': ('wide', ), 'classes': ('wide', ),
'fields': ( 'fields': (
'env', 'env_name',
'env_visible', 'env_color',
'env_visible_in_header',
'env_visible_in_favicon',
) )
}), }),
(_('Logo'), { (_('Logo'), {
@@ -92,6 +96,7 @@ class ThemeAdmin(admin.ModelAdmin):
'related_modal_background_color', 'related_modal_background_color',
'related_modal_background_opacity', 'related_modal_background_opacity',
'related_modal_rounded_corners', 'related_modal_rounded_corners',
'related_modal_close_button_visible',
) )
}), }),
(_('List Filter'), { (_('List Filter'), {
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.cache import cache, caches
def app_cache():
return caches['admin_interface'] if 'admin_interface' in settings.CACHES else cache
def del_cached_active_theme():
app_cache().delete('admin_interface_theme')
def get_cached_active_theme():
return app_cache().get('admin_interface_theme', None)
def set_cached_active_theme(theme):
app_cache().set('admin_interface_theme', theme)
Binary file not shown.
+66 -61
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: django-admin-interface\n" "Project-Id-Version: django-admin-interface\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-07 11:23-0500\n" "POT-Creation-Date: 2019-03-20 16:12+0000\n"
"PO-Revision-Date: 2018-12-30 19:13-0500\n" "PO-Revision-Date: 2018-12-30 19:13-0500\n"
"Last-Translator: Martin Vuelta <martin.vuelta@softbutterfly.io>\n" "Last-Translator: Martin Vuelta <martin.vuelta@softbutterfly.io>\n"
"Language-Team: Spanish <dev@softbutterfly.io>\n" "Language-Team: Spanish <dev@softbutterfly.io>\n"
@@ -19,169 +19,174 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: admin.py:19 #: admin_interface/admin.py:19
msgid "Environment" msgid "Environment"
msgstr "Ambiente" msgstr "Ambiente"
#: admin.py:26 #: admin_interface/admin.py:28
msgid "Logo" msgid "Logo"
msgstr "Logo" msgstr "Logo"
#: admin.py:34 #: admin_interface/admin.py:36
msgid "Favicon" msgid "Favicon"
msgstr "Favicon" msgstr "Favicon"
#: admin.py:38 #: admin_interface/admin.py:40
msgid "Title" msgid "Title"
msgstr "Título" msgstr "Título"
#: admin.py:46 #: admin_interface/admin.py:48
msgid "Header" msgid "Header"
msgstr "Encabezado" msgstr "Encabezado"
#: admin.py:55 #: admin_interface/admin.py:57
msgid "Breadcrumbs / Module headers" msgid "Breadcrumbs / Module headers"
msgstr "Breadcrumbs / Encabezados de módulos" msgstr "Breadcrumbs / Encabezados de módulos"
#: admin.py:65 #: admin_interface/admin.py:67
msgid "Generic Links" msgid "Generic Links"
msgstr "Enlaces genéricos" msgstr "Enlaces genéricos"
#: admin.py:72 #: admin_interface/admin.py:74
msgid "Save Buttons" msgid "Save Buttons"
msgstr "Botones de guardar" msgstr "Botones de guardar"
#: admin.py:80 #: admin_interface/admin.py:82
msgid "Delete Buttons" msgid "Delete Buttons"
msgstr "Botones de borrar" msgstr "Botones de borrar"
#: admin.py:88 #: admin_interface/admin.py:90
msgid "Related Modal" msgid "Related Modal"
msgstr "Modal para objetos relacionados" msgstr "Modal para objetos relacionados"
#: admin.py:97 #: admin_interface/admin.py:99
msgid "List Filter" msgid "List Filter"
msgstr "Lista de filtros" msgstr "Lista de filtros"
#: admin.py:101 #: admin_interface/admin.py:103
msgid "Recent Actions" msgid "Recent Actions"
msgstr "Acciones recientes" msgstr "Acciones recientes"
#: apps.py:11 #: admin_interface/apps.py:11
msgid "Admin Interface" msgid "Admin Interface"
msgstr "Interfaz de administración" msgstr "Interfaz de administración"
#: models.py:54 #: admin_interface/models.py:56 admin_interface/models.py:100
msgid "name" msgid "name"
msgstr "Nombre" msgstr "Nombre"
#: models.py:57 models.py:220 #: admin_interface/models.py:59 admin_interface/models.py:224
msgid "active" msgid "active"
msgstr "Activo" msgstr "Activo"
#: models.py:61 templates/admin/base_site.html:6 #: admin_interface/models.py:63
#: templates/admin/base_site.html:66 #: admin_interface/templates/admin/base_site.html:6
#: admin_interface/templates/admin/base_site.html:60
msgid "Django administration" msgid "Django administration"
msgstr "Administración de Django" msgstr "Administración de Django"
#: models.py:63 #: admin_interface/models.py:65
msgid "title" msgid "title"
msgstr "Título" msgstr "Título"
#: models.py:69 #: admin_interface/models.py:71 admin_interface/models.py:86
msgid "title color" #: admin_interface/models.py:106
msgstr "Color de título" #, fuzzy
#| msgid "logo color"
msgid "color"
msgstr "color de logo"
#: models.py:72 models.py:87 models.py:108 models.py:253 #: admin_interface/models.py:74 admin_interface/models.py:89
#: admin_interface/models.py:260
msgid "visible" msgid "visible"
msgstr "Visible" msgstr "Visible"
#: models.py:77 #: admin_interface/models.py:79
msgid "Leave blank to use the default Django logo" msgid "Leave blank to use the default Django logo"
msgstr "Dejar en blanco para usaer el logo por defecto de Django" msgstr "Dejar en blanco para usaer el logo por defecto de Django"
#: models.py:78 #: admin_interface/models.py:80
msgid "logo" msgid "logo"
msgstr "logo" msgstr "logo"
#: models.py:84 #: admin_interface/models.py:94
msgid "logo color"
msgstr "color de logo"
#: models.py:92
msgid "(.ico|.png|.gif - 16x16|32x32 px)" msgid "(.ico|.png|.gif - 16x16|32x32 px)"
msgstr "Formatos ico, png o gif. Tamaños de 16x16 o 32x32 pixeles" msgstr "Formatos ico, png o gif. Tamaños de 16x16 o 32x32 pixeles"
#: models.py:93 #: admin_interface/models.py:95
msgid "favicon" msgid "favicon"
msgstr "favicon" msgstr "favicon"
#: models.py:96 #: admin_interface/models.py:104
msgid "Development" msgid ""
msgstr "Desarrollo" "(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, green: #2ECC71, blue: "
"#3498DB)"
msgstr ""
#: models.py:97 #: admin_interface/models.py:109
msgid "Testing" msgid "visible in header (marker and name)"
msgstr "Pruebas" msgstr ""
#: models.py:98 #: admin_interface/models.py:112
msgid "Staging" msgid "visible in favicon (marker)"
msgstr "Depliegue" msgstr ""
#: models.py:99 #: admin_interface/models.py:119 admin_interface/models.py:144
msgid "Production" #: admin_interface/models.py:185 admin_interface/models.py:204
msgstr "Producción" #: admin_interface/models.py:230
#: models.py:105
msgid "environment"
msgstr "ambiente"
#: models.py:115 models.py:140 models.py:181 models.py:200 models.py:226
msgid "background color" msgid "background color"
msgstr "color de fondo" msgstr "color de fondo"
#: models.py:121 models.py:146 models.py:193 models.py:212 models.py:216 #: admin_interface/models.py:125 admin_interface/models.py:150
#: admin_interface/models.py:197 admin_interface/models.py:216
#: admin_interface/models.py:220
msgid "text color" msgid "text color"
msgstr "color de texto" msgstr "color de texto"
#: models.py:127 models.py:152 models.py:168 #: admin_interface/models.py:131 admin_interface/models.py:156
#: admin_interface/models.py:172
msgid "link color" msgid "link color"
msgstr "color de enlace" msgstr "color de enlace"
#: models.py:133 models.py:158 models.py:174 #: admin_interface/models.py:137 admin_interface/models.py:162
#: admin_interface/models.py:178
msgid "link hover color" msgid "link hover color"
msgstr "color de enlace (hover)" msgstr "color de enlace (hover)"
#: models.py:161 models.py:246 #: admin_interface/models.py:165 admin_interface/models.py:250
msgid "rounded corners" msgid "rounded corners"
msgstr "esquinas redondas" msgstr "esquinas redondas"
#: models.py:187 models.py:206 #: admin_interface/models.py:191 admin_interface/models.py:210
msgid "background hover color" msgid "background hover color"
msgstr "color de fondo (hover)" msgstr "color de fondo (hover)"
#: models.py:243 #: admin_interface/models.py:247
msgid "background opacity" msgid "background opacity"
msgstr "opacidad de fondo" msgstr "opacidad de fondo"
#: models.py:250 #: admin_interface/models.py:253
msgid "close button visible"
msgstr ""
#: admin_interface/models.py:257
msgid "use dropdown" msgid "use dropdown"
msgstr "Usar lista desplegable" msgstr "Usar lista desplegable"
#: models.py:262 #: admin_interface/models.py:269
msgid "Theme" msgid "Theme"
msgstr "Tema" msgstr "Tema"
#: models.py:263 #: admin_interface/models.py:270
msgid "Themes" msgid "Themes"
msgstr "Temas" msgstr "Temas"
#: templates/admin/filter.html:13 #: admin_interface/templates/admin/filter.html:13
#: templates/admin_interface/dropdown_filter.html:4 #: admin_interface/templates/admin_interface/dropdown_filter.html:4
#, python-format #, python-format
msgid " By %(filter_title)s " msgid " By %(filter_title)s "
msgstr " Por %(filter_title)s " msgstr " Por %(filter_title)s "
#: templates/admin/popup_response.html:3 #: admin_interface/templates/admin/popup_response.html:3
msgid "Popup closing..." msgid "Popup closing..."
msgstr "Cerando popup..." msgstr "Cerando popup..."
Binary file not shown.
+66 -61
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-07 11:23-0500\n" "POT-Creation-Date: 2019-03-20 14:12-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,169 +18,174 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: admin.py:19 #: admin_interface/admin.py:19
msgid "Environment" msgid "Environment"
msgstr "Environnment" msgstr "Environnment"
#: admin.py:26 #: admin_interface/admin.py:28
msgid "Logo" msgid "Logo"
msgstr "Logo" msgstr "Logo"
#: admin.py:34 #: admin_interface/admin.py:36
msgid "Favicon" msgid "Favicon"
msgstr "Favicon" msgstr "Favicon"
#: admin.py:38 #: admin_interface/admin.py:40
msgid "Title" msgid "Title"
msgstr "Titre" msgstr "Titre"
#: admin.py:46 #: admin_interface/admin.py:48
msgid "Header" msgid "Header"
msgstr "Bannière" msgstr "Bannière"
#: admin.py:55 #: admin_interface/admin.py:57
msgid "Breadcrumbs / Module headers" msgid "Breadcrumbs / Module headers"
msgstr "Fil d'ariane / en-têtes de module" msgstr "Fil d'ariane / en-têtes de module"
#: admin.py:65 #: admin_interface/admin.py:67
msgid "Generic Links" msgid "Generic Links"
msgstr "Liens génériques" msgstr "Liens génériques"
#: admin.py:72 #: admin_interface/admin.py:74
msgid "Save Buttons" msgid "Save Buttons"
msgstr "Boutons sauvegarder" msgstr "Boutons sauvegarder"
#: admin.py:80 #: admin_interface/admin.py:82
msgid "Delete Buttons" msgid "Delete Buttons"
msgstr "Boutons supprimer" msgstr "Boutons supprimer"
#: admin.py:88 #: admin_interface/admin.py:90
msgid "Related Modal" msgid "Related Modal"
msgstr "Modale pour objet reliés" msgstr "Modale pour objet reliés"
#: admin.py:97 #: admin_interface/admin.py:100
msgid "List Filter" msgid "List Filter"
msgstr "Filtre de liste" msgstr "Filtre de liste"
#: admin.py:101 #: admin_interface/admin.py:104
msgid "Recent Actions" msgid "Recent Actions"
msgstr "Actions récentes" msgstr "Actions récentes"
#: apps.py:11 #: admin_interface/apps.py:11
msgid "Admin Interface" msgid "Admin Interface"
msgstr "Interface Admin" msgstr "Interface Admin"
#: models.py:54 #: admin_interface/models.py:56 admin_interface/models.py:100
msgid "name" msgid "name"
msgstr "nom" msgstr "nom"
#: models.py:57 models.py:220 #: admin_interface/models.py:59 admin_interface/models.py:224
msgid "active" msgid "active"
msgstr "actif" msgstr "actif"
#: models.py:61 templates/admin/base_site.html:6 #: admin_interface/models.py:63
#: templates/admin/base_site.html:66 #: admin_interface/templates/admin/base_site.html:6
#: admin_interface/templates/admin/base_site.html:60
msgid "Django administration" msgid "Django administration"
msgstr "Administration Django" msgstr "Administration Django"
#: models.py:63 #: admin_interface/models.py:65
msgid "title" msgid "title"
msgstr "titre" msgstr "titre"
#: models.py:69 #: admin_interface/models.py:71 admin_interface/models.py:86
msgid "title color" #: admin_interface/models.py:106
msgstr "couleur du titre" msgid "color"
msgstr "couleur"
#: models.py:72 models.py:87 models.py:108 models.py:253 #: admin_interface/models.py:74 admin_interface/models.py:89
#: admin_interface/models.py:260
msgid "visible" msgid "visible"
msgstr "visible" msgstr "visible"
#: models.py:77 #: admin_interface/models.py:79
msgid "Leave blank to use the default Django logo" msgid "Leave blank to use the default Django logo"
msgstr "Laisser vide pour utiliser le logo Django par défaut" msgstr "Laisser vide pour utiliser le logo Django par défaut"
#: models.py:78 #: admin_interface/models.py:80
msgid "logo" msgid "logo"
msgstr "logo" msgstr "logo"
#: models.py:84 #: admin_interface/models.py:94
msgid "logo color"
msgstr "couleur du logo"
#: models.py:92
msgid "(.ico|.png|.gif - 16x16|32x32 px)" msgid "(.ico|.png|.gif - 16x16|32x32 px)"
msgstr "(.ico|.png|.gif - 16x16|32x32 px)" msgstr "(.ico|.png|.gif - 16x16|32x32 px)"
#: models.py:93 #: admin_interface/models.py:95
msgid "favicon" msgid "favicon"
msgstr "favicon" msgstr "favicon"
#: models.py:96 #: admin_interface/models.py:104
msgid "Development" msgid ""
msgstr "Développement" "(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, green: #2ECC71, blue: "
"#3498DB)"
msgstr ""
"(rouge: #E74C3C, orange: #E67E22, jaune: #F1C40F, vert: #2ECC71, bleu: "
"#3498DB)"
#: models.py:97 #: admin_interface/models.py:109
msgid "Testing" msgid "visible in header (marker and name)"
msgstr "Test" msgstr "visible dans len-tête (marqueur et nom)"
#: models.py:98 #: admin_interface/models.py:112
msgid "Staging" msgid "visible in favicon (marker)"
msgstr "Pré-prod" msgstr "visible dans la favicon (marqueur)"
#: models.py:99 #: admin_interface/models.py:119 admin_interface/models.py:144
msgid "Production" #: admin_interface/models.py:185 admin_interface/models.py:204
msgstr "Production" #: admin_interface/models.py:230
#: models.py:105
msgid "environment"
msgstr "environment"
#: models.py:115 models.py:140 models.py:181 models.py:200 models.py:226
msgid "background color" msgid "background color"
msgstr "couleur d'arrière-plan" msgstr "couleur d'arrière-plan"
#: models.py:121 models.py:146 models.py:193 models.py:212 models.py:216 #: admin_interface/models.py:125 admin_interface/models.py:150
#: admin_interface/models.py:197 admin_interface/models.py:216
#: admin_interface/models.py:220
msgid "text color" msgid "text color"
msgstr "couleur du texte" msgstr "couleur du texte"
#: models.py:127 models.py:152 models.py:168 #: admin_interface/models.py:131 admin_interface/models.py:156
#: admin_interface/models.py:172
msgid "link color" msgid "link color"
msgstr "couleur de lien" msgstr "couleur de lien"
#: models.py:133 models.py:158 models.py:174 #: admin_interface/models.py:137 admin_interface/models.py:162
#: admin_interface/models.py:178
msgid "link hover color" msgid "link hover color"
msgstr "couleur de lien au survol" msgstr "couleur de lien au survol"
#: models.py:161 models.py:246 #: admin_interface/models.py:165 admin_interface/models.py:250
msgid "rounded corners" msgid "rounded corners"
msgstr "coins arrondis" msgstr "coins arrondis"
#: models.py:187 models.py:206 #: admin_interface/models.py:191 admin_interface/models.py:210
msgid "background hover color" msgid "background hover color"
msgstr "couleur de fond au survol" msgstr "couleur de fond au survol"
#: models.py:243 #: admin_interface/models.py:247
msgid "background opacity" msgid "background opacity"
msgstr "opacité de l'arrière-plan" msgstr "opacité de l'arrière-plan"
#: models.py:250 #: admin_interface/models.py:253
msgid "close button visible"
msgstr "bouton fermer visible"
#: admin_interface/models.py:257
msgid "use dropdown" msgid "use dropdown"
msgstr "utiliser un menu déroulant" msgstr "utiliser un menu déroulant"
#: models.py:262 #: admin_interface/models.py:269
msgid "Theme" msgid "Theme"
msgstr "Thème" msgstr "Thème"
#: models.py:263 #: admin_interface/models.py:270
msgid "Themes" msgid "Themes"
msgstr "Thèmes" msgstr "Thèmes"
#: templates/admin/filter.html:13 #: admin_interface/templates/admin/filter.html:13
#: templates/admin_interface/dropdown_filter.html:4 #: admin_interface/templates/admin_interface/dropdown_filter.html:4
#, python-format #, python-format
msgid " By %(filter_title)s " msgid " By %(filter_title)s "
msgstr " Par %(filter_title)s " msgstr " Par %(filter_title)s "
#: templates/admin/popup_response.html:3 #: admin_interface/templates/admin/popup_response.html:3
msgid "Popup closing..." msgid "Popup closing..."
msgstr "Fermeture de la modale..." msgstr "Fermeture de la modale..."
Binary file not shown.
+81 -76
View File
@@ -2,186 +2,191 @@
# django-admin-interface package. # django-admin-interface package.
# #
# Translators: # Translators:
# Fabio Caccamo, 2019 # Fabio Caccamo <fabio.caccamo@gmail.com>, 2018
# #
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: django-admin-interface\n" "Project-Id-Version: django-admin-interface\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-07 11:23-0500\n" "POT-Creation-Date: 2019-03-20 16:12+0000\n"
"PO-Revision-Date: 2019-01-04 11:00-0000\n" "PO-Revision-Date: 2018-12-30 19:13-0500\n"
"Last-Translator: Fabio Caccamo\n" "Last-Translator: Fabio Caccamo <fabio.caccamo@gmail.com>\n"
"Language-Team: Italian\n" "Language-Team: Italian <LL@li.org>\n"
"Language: Italian \n" "Language: Italian \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: admin.py:19 #: admin_interface/admin.py:19
msgid "Environment" msgid "Environment"
msgstr "Ambiente" msgstr "Ambiente"
#: admin.py:26 #: admin_interface/admin.py:28
msgid "Logo" msgid "Logo"
msgstr "Logo" msgstr "Logo"
#: admin.py:34 #: admin_interface/admin.py:36
msgid "Favicon" msgid "Favicon"
msgstr "Favicon" msgstr "Favicon"
#: admin.py:38 #: admin_interface/admin.py:40
msgid "Title" msgid "Title"
msgstr "Titolo" msgstr "Titolo"
#: admin.py:46 #: admin_interface/admin.py:48
msgid "Header" msgid "Header"
msgstr "Header" msgstr "Header"
#: admin.py:55 #: admin_interface/admin.py:57
msgid "Breadcrumbs / Module headers" msgid "Breadcrumbs / Module headers"
msgstr "Breadcrumbs / Header dei moduli" msgstr "Breadcrumbs / Header dei moduli"
#: admin.py:65 #: admin_interface/admin.py:67
msgid "Generic Links" msgid "Generic Links"
msgstr "Link generici" msgstr "Link generici"
#: admin.py:72 #: admin_interface/admin.py:74
msgid "Save Buttons" msgid "Save Buttons"
msgstr "Pulsanti per salvare" msgstr "Pulsanti per salvare"
#: admin.py:80 #: admin_interface/admin.py:82
msgid "Delete Buttons" msgid "Delete Buttons"
msgstr "Pulsanti per eliminare" msgstr "Pulsanti per eliminare"
#: admin.py:88 #: admin_interface/admin.py:90
msgid "Related Modal" msgid "Related Modal"
msgstr "Modale per gli oggetti correlati" msgstr "Modale per gli oggetti correlati"
#: admin.py:97 #: admin_interface/admin.py:99
msgid "List Filter" msgid "List Filter"
msgstr "Filtro listato" msgstr "Filtro listato"
#: admin.py:101 #: admin_interface/admin.py:103
msgid "Recent Actions" msgid "Recent Actions"
msgstr "Azioni recenti" msgstr "Azioni recenti"
#: apps.py:11 #: admin_interface/apps.py:11
msgid "Admin Interface" msgid "Admin Interface"
msgstr "Interfaccia di admin" msgstr "Interfaccia di amministrazione"
#: models.py:54 #: admin_interface/models.py:56 admin_interface/models.py:100
msgid "name" msgid "name"
msgstr "Nome" msgstr "nome"
#: models.py:57 models.py:220 #: admin_interface/models.py:59 admin_interface/models.py:224
msgid "active" msgid "active"
msgstr "Attivo" msgstr "attivo"
#: models.py:61 templates/admin/base_site.html:6 #: admin_interface/models.py:63
#: templates/admin/base_site.html:66 #: admin_interface/templates/admin/base_site.html:6
#: admin_interface/templates/admin/base_site.html:60
msgid "Django administration" msgid "Django administration"
msgstr "Amministrazione di Django" msgstr "Amministrazione di Django"
#: models.py:63 #: admin_interface/models.py:65
msgid "title" msgid "title"
msgstr "Titolo" msgstr "titolo"
#: models.py:69 #: admin_interface/models.py:71 admin_interface/models.py:86
msgid "title color" #: admin_interface/models.py:106
msgstr "Colore del titolo" msgid "color"
msgstr "colore"
#: models.py:72 models.py:87 models.py:108 models.py:253 #: admin_interface/models.py:74 admin_interface/models.py:89
#: admin_interface/models.py:260
msgid "visible" msgid "visible"
msgstr "Visibile" msgstr "visibile"
#: models.py:77 #: admin_interface/models.py:79
msgid "Leave blank to use the default Django logo" msgid "Leave blank to use the default Django logo"
msgstr "Lasciare vuoto per usare il logo Django di default" msgstr "Lasciare vuoto per usare il logo Django di default"
#: models.py:78 #: admin_interface/models.py:80
msgid "logo" msgid "logo"
msgstr "logo" msgstr "logo"
#: models.py:84 #: admin_interface/models.py:94
msgid "logo color"
msgstr "colore del logo"
#: models.py:92
msgid "(.ico|.png|.gif - 16x16|32x32 px)" msgid "(.ico|.png|.gif - 16x16|32x32 px)"
msgstr "Formato ico, png o gif. Dimensioni 16x16 o 32x32 px" msgstr "(formato ico, png o gif - dimensioni 16x16 o 32x32 px)"
#: models.py:93 #: admin_interface/models.py:95
msgid "favicon" msgid "favicon"
msgstr "favicon" msgstr "favicon"
#: models.py:96 #: admin_interface/models.py:104
msgid "Development" msgid ""
msgstr "Sviluppo" "(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, green: #2ECC71, blue: "
"#3498DB)"
msgstr ""
"(rosso: #E74C3C, arancione: #E67E22, giallo: #F1C40F, verde: #2ECC71, blu: "
"#3498DB)"
#: models.py:97 #: admin_interface/models.py:109
msgid "Testing" msgid "visible in header (marker and name)"
msgstr "Testing" msgstr "visibile nell'header (marker e nome)"
#: models.py:98 #: admin_interface/models.py:112
msgid "Staging" msgid "visible in favicon (marker)"
msgstr "Staging" msgstr "visibile nella favicon (marker)"
#: models.py:99 #: admin_interface/models.py:119 admin_interface/models.py:144
msgid "Production" #: admin_interface/models.py:185 admin_interface/models.py:204
msgstr "Produzione" #: admin_interface/models.py:230
#: models.py:105
msgid "environment"
msgstr "ambiente"
#: models.py:115 models.py:140 models.py:181 models.py:200 models.py:226
msgid "background color" msgid "background color"
msgstr "colore di sfondo" msgstr "colore di sfondo"
#: models.py:121 models.py:146 models.py:193 models.py:212 models.py:216 #: admin_interface/models.py:125 admin_interface/models.py:150
#: admin_interface/models.py:197 admin_interface/models.py:216
#: admin_interface/models.py:220
msgid "text color" msgid "text color"
msgstr "color del testo" msgstr "colore del testo"
#: models.py:127 models.py:152 models.py:168 #: admin_interface/models.py:131 admin_interface/models.py:156
#: admin_interface/models.py:172
msgid "link color" msgid "link color"
msgstr "color dei link" msgstr "colore dei link"
#: models.py:133 models.py:158 models.py:174 #: admin_interface/models.py:137 admin_interface/models.py:162
#: admin_interface/models.py:178
msgid "link hover color" msgid "link hover color"
msgstr "color dei link in hover" msgstr "colore dei link in hover"
#: models.py:161 models.py:246 #: admin_interface/models.py:165 admin_interface/models.py:250
msgid "rounded corners" msgid "rounded corners"
msgstr "bordi arrotondati" msgstr "bordi arrotondati"
#: models.py:187 models.py:206 #: admin_interface/models.py:191 admin_interface/models.py:210
msgid "background hover color" msgid "background hover color"
msgstr "colore di sfondo in hover" msgstr "colore di sfondo in hover"
#: models.py:243 #: admin_interface/models.py:247
msgid "background opacity" msgid "background opacity"
msgstr "opacità dello sfondo" msgstr "opacità dello sfondo"
#: models.py:250 #: admin_interface/models.py:253
msgid "use dropdown" msgid "close button visible"
msgstr "Usa dropdown" msgstr "pulsante chiudi visibile"
#: models.py:262 #: admin_interface/models.py:257
msgid "use dropdown"
msgstr "usa dropdown"
#: admin_interface/models.py:269
msgid "Theme" msgid "Theme"
msgstr "Tema" msgstr "Tema"
#: models.py:263 #: admin_interface/models.py:270
msgid "Themes" msgid "Themes"
msgstr "Temi" msgstr "Temi"
#: templates/admin/filter.html:13 #: admin_interface/templates/admin/filter.html:13
#: templates/admin_interface/dropdown_filter.html:4 #: admin_interface/templates/admin_interface/dropdown_filter.html:4
#, python-format #, python-format
msgid " By %(filter_title)s " msgid " By %(filter_title)s "
msgstr " Per %(filter_title)s " msgstr " Per %(filter_title)s "
#: templates/admin/popup_response.html:3 #: admin_interface/templates/admin/popup_response.html:3
msgid "Popup closing..." msgid "Popup closing..."
msgstr "Chiusura popup..." msgstr "Chiusura popup..."
@@ -12,7 +12,11 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.AlterField( migrations.RemoveField(
model_name='theme',
name='related_modal_background_opacity'
),
migrations.AddField(
model_name='theme', model_name='theme',
name='related_modal_background_opacity', name='related_modal_background_opacity',
field=models.CharField( field=models.CharField(
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import colorfield.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('admin_interface', '0010_add_localization'),
]
operations = [
migrations.RenameField(
model_name='theme',
old_name='env',
new_name='env_name',
),
migrations.AlterField(
model_name='theme',
name='env_name',
field=models.CharField(
blank=True,
max_length=50,
verbose_name='name'),
),
migrations.AddField(
model_name='theme',
name='env_color',
field=colorfield.fields.ColorField(
blank=True,
default='#E74C3C',
help_text='(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, green: #2ECC71, blue: #3498DB)',
max_length=10,
verbose_name='color'),
),
migrations.RenameField(
model_name='theme',
old_name='env_visible',
new_name='env_visible_in_header',
),
migrations.AlterField(
model_name='theme',
name='env_visible_in_header',
field=models.BooleanField(
default=True,
verbose_name='visible in header (marker and name)'),
),
migrations.AddField(
model_name='theme',
name='env_visible_in_favicon',
field=models.BooleanField(
default=True,
verbose_name='visible in favicon (marker)'),
),
]
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('admin_interface', '0011_add_environment_options'),
]
operations = [
migrations.AlterField(
model_name='theme',
name='logo_color',
field=colorfield.fields.ColorField(blank=True, default='#FFFFFF', help_text='#FFFFFF', max_length=10, verbose_name='color'),
),
migrations.AlterField(
model_name='theme',
name='title_color',
field=colorfield.fields.ColorField(blank=True, default='#F5DD5D', help_text='#F5DD5D', max_length=10, verbose_name='color'),
),
]
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('admin_interface', '0012_update_verbose_names'),
]
operations = [
migrations.AddField(
model_name='theme',
name='related_modal_close_button_visible',
field=models.BooleanField(default=True, verbose_name='close button visible'),
),
]
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('admin_interface', '0013_add_related_modal_close_button'),
]
operations = [
migrations.AlterField(
model_name='theme',
name='name',
field=models.CharField(default='Django', max_length=50, unique=True, verbose_name='name'),
),
]
+38 -15
View File
@@ -1,31 +1,47 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models from django.db import models
from django.db.models.signals import post_delete, post_save from django.db.models.signals import post_delete, post_save, pre_save
from django.utils.encoding import python_2_unicode_compatible, force_text from django.utils.encoding import python_2_unicode_compatible, force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from colorfield.fields import ColorField from colorfield.fields import ColorField
from admin_interface.cache import del_cached_active_theme
@python_2_unicode_compatible @python_2_unicode_compatible
class Theme(models.Model): class Theme(models.Model):
@staticmethod @staticmethod
def post_migrate_handler(**kwargs): def post_migrate_handler(**kwargs):
del_cached_active_theme()
Theme.get_active_theme() Theme.get_active_theme()
@staticmethod @staticmethod
def post_delete_handler(**kwargs): def post_delete_handler(**kwargs):
del_cached_active_theme()
Theme.get_active_theme() Theme.get_active_theme()
@staticmethod @staticmethod
def post_save_handler(instance, **kwargs): def post_save_handler(instance, **kwargs):
del_cached_active_theme()
if instance.active: if instance.active:
Theme.objects.exclude(pk=instance.pk).update(active=False) Theme.objects.exclude(pk=instance.pk).update(active=False)
Theme.get_active_theme() Theme.get_active_theme()
@staticmethod
def pre_save_handler(instance, **kwargs):
if instance.pk is None:
try:
obj = Theme.objects.get(name=instance.name)
if obj:
instance.pk = obj.pk
except Theme.DoesNotExist:
pass
@staticmethod @staticmethod
def get_active_theme(): def get_active_theme():
objs_manager = Theme.objects objs_manager = Theme.objects
@@ -50,6 +66,7 @@ class Theme(models.Model):
return obj return obj
name = models.CharField( name = models.CharField(
unique=True,
max_length=50, max_length=50,
default='Django', default='Django',
verbose_name=_('name')) verbose_name=_('name'))
@@ -67,7 +84,7 @@ class Theme(models.Model):
default='#F5DD5D', default='#F5DD5D',
help_text='#F5DD5D', help_text='#F5DD5D',
max_length=10, max_length=10,
verbose_name=_('title color')) verbose_name=_('color'))
title_visible = models.BooleanField( title_visible = models.BooleanField(
default=True, default=True,
verbose_name=_('visible')) verbose_name=_('visible'))
@@ -82,7 +99,7 @@ class Theme(models.Model):
default='#FFFFFF', default='#FFFFFF',
help_text='#FFFFFF', help_text='#FFFFFF',
max_length=10, max_length=10,
verbose_name=_('logo color')) verbose_name=_('color'))
logo_visible = models.BooleanField( logo_visible = models.BooleanField(
default=True, default=True,
verbose_name=_('visible')) verbose_name=_('visible'))
@@ -93,20 +110,22 @@ class Theme(models.Model):
help_text=_('(.ico|.png|.gif - 16x16|32x32 px)'), help_text=_('(.ico|.png|.gif - 16x16|32x32 px)'),
verbose_name=_('favicon')) verbose_name=_('favicon'))
env_choices = ( env_name = models.CharField(
('development', _('Development'), ), blank=True,
('testing', _('Testing'), ),
('staging', _('Staging'), ),
('production', _('Production'), ),
)
env = models.CharField(
max_length=50, max_length=50,
choices=env_choices, verbose_name=_('name'))
default='development', env_color = ColorField(
verbose_name=_('environment')) blank=True,
env_visible = models.BooleanField( default='#E74C3C',
help_text=_('(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, green: #2ECC71, blue: #3498DB)'),
max_length=10,
verbose_name=_('color'))
env_visible_in_header = models.BooleanField(
default=True, default=True,
verbose_name=_('visible')) verbose_name=_('visible in header (marker and name)'))
env_visible_in_favicon = models.BooleanField(
default=True,
verbose_name=_('visible in favicon (marker)'))
css_header_background_color = ColorField( css_header_background_color = ColorField(
blank=True, blank=True,
@@ -245,6 +264,9 @@ class Theme(models.Model):
related_modal_rounded_corners = models.BooleanField( related_modal_rounded_corners = models.BooleanField(
default=True, default=True,
verbose_name=_('rounded corners')) verbose_name=_('rounded corners'))
related_modal_close_button_visible = models.BooleanField(
default=True,
verbose_name=_('close button visible'))
list_filter_dropdown = models.BooleanField( list_filter_dropdown = models.BooleanField(
default=False, default=False,
@@ -269,3 +291,4 @@ class Theme(models.Model):
post_delete.connect(Theme.post_delete_handler, sender=Theme) post_delete.connect(Theme.post_delete_handler, sender=Theme)
post_save.connect(Theme.post_save_handler, sender=Theme) post_save.connect(Theme.post_save_handler, sender=Theme)
pre_save.connect(Theme.pre_save_handler, sender=Theme)
@@ -0,0 +1,913 @@
/**
* @license MIT or GPL-2.0
* @fileOverview Favico animations
* @author Miroslav Magda, http://blog.ejci.net
* @source: https://github.com/ejci/favico.js
* @version 0.3.10
*/
/**
* Create new favico instance
* @param {Object} Options
* @return {Object} Favico object
* @example
* var favico = new Favico({
* bgColor : '#d00',
* textColor : '#fff',
* fontFamily : 'sans-serif',
* fontStyle : 'bold',
* type : 'circle',
* position : 'down',
* animation : 'slide',
* elementId: false,
* element: null,
* dataUrl: function(url){},
* win: window
* });
*/
(function () {
var Favico = (function (opt) {
'use strict';
opt = (opt) ? opt : {};
var _def = {
bgColor: '#d00',
textColor: '#fff',
fontFamily: 'sans-serif', //Arial,Verdana,Times New Roman,serif,sans-serif,...
fontStyle: 'bold', //normal,italic,oblique,bold,bolder,lighter,100,200,300,400,500,600,700,800,900
type: 'circle',
position: 'down', // down, up, left, leftup (upleft)
animation: 'slide',
elementId: false,
element: null,
dataUrl: false,
win: window
};
var _opt, _orig, _h, _w, _canvas, _context, _img, _ready, _lastBadge, _running, _readyCb, _stop, _browser, _animTimeout, _drawTimeout, _doc;
_browser = {};
_browser.ff = typeof InstallTrigger != 'undefined';
_browser.chrome = !!window.chrome;
_browser.opera = !!window.opera || navigator.userAgent.indexOf('Opera') >= 0;
_browser.ie = /*@cc_on!@*/false;
_browser.safari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
_browser.supported = (_browser.chrome || _browser.ff || _browser.opera);
var _queue = [];
_readyCb = function () {
};
_ready = _stop = false;
/**
* Initialize favico
*/
var init = function () {
//merge initial options
_opt = merge(_def, opt);
_opt.bgColor = hexToRgb(_opt.bgColor);
_opt.textColor = hexToRgb(_opt.textColor);
_opt.position = _opt.position.toLowerCase();
_opt.animation = (animation.types['' + _opt.animation]) ? _opt.animation : _def.animation;
_doc = _opt.win.document;
var isUp = _opt.position.indexOf('up') > -1;
var isLeft = _opt.position.indexOf('left') > -1;
//transform the animations
if (isUp || isLeft) {
for (var a in animation.types) {
for (var i = 0; i < animation.types[a].length; i++) {
var step = animation.types[a][i];
if (isUp) {
if (step.y < 0.6) {
step.y = step.y - 0.4;
} else {
step.y = step.y - 2 * step.y + (1 - step.w);
}
}
if (isLeft) {
if (step.x < 0.6) {
step.x = step.x - 0.4;
} else {
step.x = step.x - 2 * step.x + (1 - step.h);
}
}
animation.types[a][i] = step;
}
}
}
_opt.type = (type['' + _opt.type]) ? _opt.type : _def.type;
_orig = link. getIcons();
//create temp canvas
_canvas = document.createElement('canvas');
//create temp image
_img = document.createElement('img');
var lastIcon = _orig[_orig.length - 1];
if (lastIcon.hasAttribute('href')) {
_img.setAttribute('crossOrigin', 'anonymous');
//get width/height
_img.onload = function () {
_h = (_img.height > 0) ? _img.height : 32;
_w = (_img.width > 0) ? _img.width : 32;
_canvas.height = _h;
_canvas.width = _w;
_context = _canvas.getContext('2d');
icon.ready();
};
_img.setAttribute('src', lastIcon.getAttribute('href'));
} else {
_h = 32;
_w = 32;
_img.height = _h;
_img.width = _w;
_canvas.height = _h;
_canvas.width = _w;
_context = _canvas.getContext('2d');
icon.ready();
}
};
/**
* Icon namespace
*/
var icon = {};
/**
* Icon is ready (reset icon) and start animation (if ther is any)
*/
icon.ready = function () {
_ready = true;
icon.reset();
_readyCb();
};
/**
* Reset icon to default state
*/
icon.reset = function () {
//reset
if (!_ready) {
return;
}
_queue = [];
_lastBadge = false;
_running = false;
_context.clearRect(0, 0, _w, _h);
_context.drawImage(_img, 0, 0, _w, _h);
//_stop=true;
link.setIcon(_canvas);
//webcam('stop');
//video('stop');
window.clearTimeout(_animTimeout);
window.clearTimeout(_drawTimeout);
};
/**
* Start animation
*/
icon.start = function () {
if (!_ready || _running) {
return;
}
var finished = function () {
_lastBadge = _queue[0];
_running = false;
if (_queue.length > 0) {
_queue.shift();
icon.start();
} else {
}
};
if (_queue.length > 0) {
_running = true;
var run = function () {
// apply options for this animation
['type', 'animation', 'bgColor', 'textColor', 'fontFamily', 'fontStyle'].forEach(function (a) {
if (a in _queue[0].options) {
_opt[a] = _queue[0].options[a];
}
});
animation.run(_queue[0].options, function () {
finished();
}, false);
};
if (_lastBadge) {
animation.run(_lastBadge.options, function () {
run();
}, true);
} else {
run();
}
}
};
/**
* Badge types
*/
var type = {};
var options = function (opt) {
opt.n = ((typeof opt.n) === 'number') ? Math.abs(opt.n | 0) : opt.n;
opt.x = _w * opt.x;
opt.y = _h * opt.y;
opt.w = _w * opt.w;
opt.h = _h * opt.h;
opt.len = ("" + opt.n).length;
return opt;
};
/**
* Generate circle
* @param {Object} opt Badge options
*/
type.circle = function (opt) {
opt = options(opt);
var more = false;
if (opt.len === 2) {
opt.x = opt.x - opt.w * 0.4;
opt.w = opt.w * 1.4;
more = true;
} else if (opt.len >= 3) {
opt.x = opt.x - opt.w * 0.65;
opt.w = opt.w * 1.65;
more = true;
}
// begin patch
// draw a smaller badge without text
opt.w = 14;
opt.h = 14;
opt.x = (_w - opt.w);
opt.y = (_h - opt.h);
// end patch
_context.clearRect(0, 0, _w, _h);
_context.drawImage(_img, 0, 0, _w, _h);
_context.beginPath();
_context.font = _opt.fontStyle + " " + Math.floor(opt.h * (opt.n > 99 ? 0.85 : 1)) + "px " + _opt.fontFamily;
_context.textAlign = 'center';
if (more) {
_context.moveTo(opt.x + opt.w / 2, opt.y);
_context.lineTo(opt.x + opt.w - opt.h / 2, opt.y);
_context.quadraticCurveTo(opt.x + opt.w, opt.y, opt.x + opt.w, opt.y + opt.h / 2);
_context.lineTo(opt.x + opt.w, opt.y + opt.h - opt.h / 2);
_context.quadraticCurveTo(opt.x + opt.w, opt.y + opt.h, opt.x + opt.w - opt.h / 2, opt.y + opt.h);
_context.lineTo(opt.x + opt.h / 2, opt.y + opt.h);
_context.quadraticCurveTo(opt.x, opt.y + opt.h, opt.x, opt.y + opt.h - opt.h / 2);
_context.lineTo(opt.x, opt.y + opt.h / 2);
_context.quadraticCurveTo(opt.x, opt.y, opt.x + opt.h / 2, opt.y);
} else {
_context.arc(opt.x + opt.w / 2, opt.y + opt.h / 2, opt.h / 2, 0, 2 * Math.PI);
}
_context.fillStyle = 'rgba(' + _opt.bgColor.r + ',' + _opt.bgColor.g + ',' + _opt.bgColor.b + ',' + opt.o + ')';
_context.fill();
_context.closePath();
_context.beginPath();
_context.stroke();
_context.fillStyle = 'rgba(' + _opt.textColor.r + ',' + _opt.textColor.g + ',' + _opt.textColor.b + ',' + opt.o + ')';
//_context.fillText((more) ? '9+' : opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
if ((typeof opt.n) === 'number' && opt.n > 999) {
_context.fillText(((opt.n > 9999) ? 9 : Math.floor(opt.n / 1000)) + 'k+', Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.2));
} else {
_context.fillText(opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
}
_context.closePath();
};
/**
* Generate rectangle
* @param {Object} opt Badge options
*/
type.rectangle = function (opt) {
opt = options(opt);
var more = false;
if (opt.len === 2) {
opt.x = opt.x - opt.w * 0.4;
opt.w = opt.w * 1.4;
more = true;
} else if (opt.len >= 3) {
opt.x = opt.x - opt.w * 0.65;
opt.w = opt.w * 1.65;
more = true;
}
_context.clearRect(0, 0, _w, _h);
_context.drawImage(_img, 0, 0, _w, _h);
_context.beginPath();
_context.font = _opt.fontStyle + " " + Math.floor(opt.h * (opt.n > 99 ? 0.9 : 1)) + "px " + _opt.fontFamily;
_context.textAlign = 'center';
_context.fillStyle = 'rgba(' + _opt.bgColor.r + ',' + _opt.bgColor.g + ',' + _opt.bgColor.b + ',' + opt.o + ')';
_context.fillRect(opt.x, opt.y, opt.w, opt.h);
_context.fillStyle = 'rgba(' + _opt.textColor.r + ',' + _opt.textColor.g + ',' + _opt.textColor.b + ',' + opt.o + ')';
//_context.fillText((more) ? '9+' : opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
if ((typeof opt.n) === 'number' && opt.n > 999) {
_context.fillText(((opt.n > 9999) ? 9 : Math.floor(opt.n / 1000)) + 'k+', Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.2));
} else {
_context.fillText(opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15));
}
_context.closePath();
};
/**
* Set badge
*/
var badge = function (number, opts) {
opts = ((typeof opts) === 'string' ? {
animation: opts
} : opts) || {};
_readyCb = function () {
try {
if (typeof (number) === 'number' ? (number > 0) : (number !== '')) {
var q = {
type: 'badge',
options: {
n: number
}
};
if ('animation' in opts && animation.types['' + opts.animation]) {
q.options.animation = '' + opts.animation;
}
if ('type' in opts && type['' + opts.type]) {
q.options.type = '' + opts.type;
}
['bgColor', 'textColor'].forEach(function (o) {
if (o in opts) {
q.options[o] = hexToRgb(opts[o]);
}
});
['fontStyle', 'fontFamily'].forEach(function (o) {
if (o in opts) {
q.options[o] = opts[o];
}
});
_queue.push(q);
if (_queue.length > 100) {
throw new Error('Too many badges requests in queue.');
}
icon.start();
} else {
icon.reset();
}
} catch (e) {
throw new Error('Error setting badge. Message: ' + e.message);
}
};
if (_ready) {
_readyCb();
}
};
/**
* Set image as icon
*/
var image = function (imageElement) {
_readyCb = function () {
try {
var w = imageElement.width;
var h = imageElement.height;
var newImg = document.createElement('img');
var ratio = (w / _w < h / _h) ? (w / _w) : (h / _h);
newImg.setAttribute('crossOrigin', 'anonymous');
newImg.onload=function(){
_context.clearRect(0, 0, _w, _h);
_context.drawImage(newImg, 0, 0, _w, _h);
link.setIcon(_canvas);
};
newImg.setAttribute('src', imageElement.getAttribute('src'));
newImg.height = (h / ratio);
newImg.width = (w / ratio);
} catch (e) {
throw new Error('Error setting image. Message: ' + e.message);
}
};
if (_ready) {
_readyCb();
}
};
/**
* Set the icon from a source url. Won't work with badges.
*/
var rawImageSrc = function (url) {
_readyCb = function() {
link.setIconSrc(url);
};
if (_ready) {
_readyCb();
}
};
/**
* Set video as icon
*/
var video = function (videoElement) {
_readyCb = function () {
try {
if (videoElement === 'stop') {
_stop = true;
icon.reset();
_stop = false;
return;
}
//var w = videoElement.width;
//var h = videoElement.height;
//var ratio = (w / _w < h / _h) ? (w / _w) : (h / _h);
videoElement.addEventListener('play', function () {
drawVideo(this);
}, false);
} catch (e) {
throw new Error('Error setting video. Message: ' + e.message);
}
};
if (_ready) {
_readyCb();
}
};
/**
* Set video as icon
*/
var webcam = function (action) {
//UR
if (!window.URL || !window.URL.createObjectURL) {
window.URL = window.URL || {};
window.URL.createObjectURL = function (obj) {
return obj;
};
}
if (_browser.supported) {
var newVideo = false;
navigator.getUserMedia = navigator.getUserMedia || navigator.oGetUserMedia || navigator.msGetUserMedia || navigator.mozGetUserMedia || navigator.webkitGetUserMedia;
_readyCb = function () {
try {
if (action === 'stop') {
_stop = true;
icon.reset();
_stop = false;
return;
}
newVideo = document.createElement('video');
newVideo.width = _w;
newVideo.height = _h;
navigator.getUserMedia({
video: true,
audio: false
}, function (stream) {
newVideo.src = URL.createObjectURL(stream);
newVideo.play();
drawVideo(newVideo);
}, function () {
});
} catch (e) {
throw new Error('Error setting webcam. Message: ' + e.message);
}
};
if (_ready) {
_readyCb();
}
}
};
var setOpt = function (key, value) {
var opts = key;
if (!(value == null && Object.prototype.toString.call(key) == '[object Object]')) {
opts = {};
opts[key] = value;
}
var keys = Object.keys(opts);
for (var i = 0; i < keys.length; i++) {
if (keys[i] == 'bgColor' || keys[i] == 'textColor') {
_opt[keys[i]] = hexToRgb(opts[keys[i]]);
} else {
_opt[keys[i]] = opts[keys[i]];
}
}
_queue.push(_lastBadge);
icon.start();
};
/**
* Draw video to context and repeat :)
*/
function drawVideo(video) {
if (video.paused || video.ended || _stop) {
return false;
}
//nasty hack for FF webcam (Thanks to Julian Ćwirko, kontakt@redsunmedia.pl)
try {
_context.clearRect(0, 0, _w, _h);
_context.drawImage(video, 0, 0, _w, _h);
} catch (e) {
}
_drawTimeout = setTimeout(function () {
drawVideo(video);
}, animation.duration);
link.setIcon(_canvas);
}
var link = {};
/**
* Get icons from HEAD tag or create a new <link> element
*/
link.getIcons = function () {
var elms = [];
//get link element
var getLinks = function () {
var icons = [];
var links = _doc.getElementsByTagName('head')[0].getElementsByTagName('link');
for (var i = 0; i < links.length; i++) {
if ((/(^|\s)icon(\s|$)/i).test(links[i].getAttribute('rel'))) {
icons.push(links[i]);
}
}
return icons;
};
if (_opt.element) {
elms = [_opt.element];
} else if (_opt.elementId) {
//if img element identified by elementId
elms = [_doc.getElementById(_opt.elementId)];
elms[0].setAttribute('href', elms[0].getAttribute('src'));
} else {
//if link element
elms = getLinks();
if (elms.length === 0) {
elms = [_doc.createElement('link')];
elms[0].setAttribute('rel', 'icon');
_doc.getElementsByTagName('head')[0].appendChild(elms[0]);
}
}
elms.forEach(function(item) {
item.setAttribute('type', 'image/png');
});
return elms;
};
link.setIcon = function (canvas) {
var url = canvas.toDataURL('image/png');
link.setIconSrc(url);
};
link.setIconSrc = function (url) {
if (_opt.dataUrl) {
//if using custom exporter
_opt.dataUrl(url);
}
if (_opt.element) {
_opt.element.setAttribute('href', url);
_opt.element.setAttribute('src', url);
} else if (_opt.elementId) {
//if is attached to element (image)
var elm = _doc.getElementById(_opt.elementId);
elm.setAttribute('href', url);
elm.setAttribute('src', url);
} else {
//if is attached to fav icon
if (_browser.ff || _browser.opera) {
//for FF we need to "recreate" element, atach to dom and remove old <link>
//var originalType = _orig.getAttribute('rel');
var old = _orig[_orig.length - 1];
var newIcon = _doc.createElement('link');
_orig = [newIcon];
//_orig.setAttribute('rel', originalType);
if (_browser.opera) {
newIcon.setAttribute('rel', 'icon');
}
newIcon.setAttribute('rel', 'icon');
newIcon.setAttribute('type', 'image/png');
_doc.getElementsByTagName('head')[0].appendChild(newIcon);
newIcon.setAttribute('href', url);
if (old.parentNode) {
old.parentNode.removeChild(old);
}
} else {
_orig.forEach(function(icon) {
icon.setAttribute('href', url);
});
}
}
};
//http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb#answer-5624139
//HEX to RGB convertor
function hexToRgb(hex) {
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, function (m, r, g, b) {
return r + r + g + g + b + b;
});
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : false;
}
/**
* Merge options
*/
function merge(def, opt) {
var mergedOpt = {};
var attrname;
for (attrname in def) {
mergedOpt[attrname] = def[attrname];
}
for (attrname in opt) {
mergedOpt[attrname] = opt[attrname];
}
return mergedOpt;
}
/**
* Cross-browser page visibility shim
* http://stackoverflow.com/questions/12536562/detect-whether-a-window-is-visible
*/
function isPageHidden() {
return _doc.hidden || _doc.msHidden || _doc.webkitHidden || _doc.mozHidden;
}
/**
* @namespace animation
*/
var animation = {};
/**
* Animation "frame" duration
*/
animation.duration = 40;
/**
* Animation types (none,fade,pop,slide)
*/
animation.types = {};
animation.types.fade = [{
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.0
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.1
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.2
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.3
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.4
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.5
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.6
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.7
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.8
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 0.9
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 1.0
}];
animation.types.none = [{
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 1
}];
animation.types.pop = [{
x: 1,
y: 1,
w: 0,
h: 0,
o: 1
}, {
x: 0.9,
y: 0.9,
w: 0.1,
h: 0.1,
o: 1
}, {
x: 0.8,
y: 0.8,
w: 0.2,
h: 0.2,
o: 1
}, {
x: 0.7,
y: 0.7,
w: 0.3,
h: 0.3,
o: 1
}, {
x: 0.6,
y: 0.6,
w: 0.4,
h: 0.4,
o: 1
}, {
x: 0.5,
y: 0.5,
w: 0.5,
h: 0.5,
o: 1
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 1
}];
animation.types.popFade = [{
x: 0.75,
y: 0.75,
w: 0,
h: 0,
o: 0
}, {
x: 0.65,
y: 0.65,
w: 0.1,
h: 0.1,
o: 0.2
}, {
x: 0.6,
y: 0.6,
w: 0.2,
h: 0.2,
o: 0.4
}, {
x: 0.55,
y: 0.55,
w: 0.3,
h: 0.3,
o: 0.6
}, {
x: 0.50,
y: 0.50,
w: 0.4,
h: 0.4,
o: 0.8
}, {
x: 0.45,
y: 0.45,
w: 0.5,
h: 0.5,
o: 0.9
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 1
}];
animation.types.slide = [{
x: 0.4,
y: 1,
w: 0.6,
h: 0.6,
o: 1
}, {
x: 0.4,
y: 0.9,
w: 0.6,
h: 0.6,
o: 1
}, {
x: 0.4,
y: 0.9,
w: 0.6,
h: 0.6,
o: 1
}, {
x: 0.4,
y: 0.8,
w: 0.6,
h: 0.6,
o: 1
}, {
x: 0.4,
y: 0.7,
w: 0.6,
h: 0.6,
o: 1
}, {
x: 0.4,
y: 0.6,
w: 0.6,
h: 0.6,
o: 1
}, {
x: 0.4,
y: 0.5,
w: 0.6,
h: 0.6,
o: 1
}, {
x: 0.4,
y: 0.4,
w: 0.6,
h: 0.6,
o: 1
}];
/**
* Run animation
* @param {Object} opt Animation options
* @param {Object} cb Callabak after all steps are done
* @param {Object} revert Reverse order? true|false
* @param {Object} step Optional step number (frame bumber)
*/
animation.run = function (opt, cb, revert, step) {
var animationType = animation.types[isPageHidden() ? 'none' : _opt.animation];
if (revert === true) {
step = (typeof step !== 'undefined') ? step : animationType.length - 1;
} else {
step = (typeof step !== 'undefined') ? step : 0;
}
cb = (cb) ? cb : function () {
};
if ((step < animationType.length) && (step >= 0)) {
type[_opt.type](merge(opt, animationType[step]));
_animTimeout = setTimeout(function () {
if (revert) {
step = step - 1;
} else {
step = step + 1;
}
animation.run(opt, cb, revert, step);
}, animation.duration);
link.setIcon(_canvas);
} else {
cb();
return;
}
};
//auto init
init();
return {
badge: badge,
video: video,
image: image,
rawImageSrc: rawImageSrc,
webcam: webcam,
setOpt: setOpt,
reset: icon.reset,
browser: {
supported: _browser.supported
}
};
});
// AMD / RequireJS
if (typeof define !== 'undefined' && define.amd) {
define([], function () {
return Favico;
});
}
// CommonJS
else if (typeof module !== 'undefined' && module.exports) {
module.exports = Favico;
}
// included directly via <script> tag
else {
this.Favico = Favico;
}
})();
File diff suppressed because one or more lines are too long
@@ -79,8 +79,9 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
// build the iframe html // build the iframe html
var iframeHTML = '<iframe id="related-modal-iframe" name="' + iframeName + '" src="' + iframeSrc + '"></iframe>'; var iframeHTML = '<iframe id="related-modal-iframe" name="' + iframeName + '" src="' + iframeSrc + '"></iframe>';
// create the iframe jquery element var modalHTML = '<div class="related-modal-iframe-container">' + iframeHTML + '</div>';
var iframeEl = $(iframeHTML); var modalEl = $(modalHTML);
var iframeEl = modalEl.find('#related-modal-iframe');
if (e.data.lookup === true) if (e.data.lookup === true)
{ {
@@ -105,8 +106,10 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
// open the popup using magnific popup // open the popup using magnific popup
$.magnificPopup.open({ $.magnificPopup.open({
mainClass: iframeInternalModalClass, mainClass: iframeInternalModalClass,
showCloseBtn: true,
closeBtnInside: true,
items: { items: {
src: iframeEl, src: modalEl,
type: 'inline' type: 'inline'
} }
}); });
@@ -115,17 +118,31 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
} }
// listen click events on related links // listen click events on related links
function presentRelatedObjectModalOnClickOn(selector, lookup) {
var data = {
lookup:(lookup === true ? true : false)
};
var el = $(selector);
el.removeAttr('onclick');
el.unbind('click');
el.click(data, presentRelatedObjectModal);
}
// django 1.7 compatibility // django 1.7 compatibility
$('a.add-another').removeAttr('onclick'); // $('a.add-another').removeAttr('onclick').click({ lookup:false }, presentRelatedObjectModal);
$('a.add-another').click({ lookup:false }, presentRelatedObjectModal); presentRelatedObjectModalOnClickOn('a.add-another');
// django 1.8 and above // django 1.8 and above
$('a.related-widget-wrapper-link').click({ lookup:false }, presentRelatedObjectModal); // $('a.related-widget-wrapper-link').click({ lookup:false }, presentRelatedObjectModal);
presentRelatedObjectModalOnClickOn('a.related-widget-wrapper-link');
// raw_id_fields support // raw_id_fields support
$('a.related-lookup').unbind('click'); // $('a.related-lookup').unbind('click').click({ lookup:true }, presentRelatedObjectModal);
$('a.related-lookup').click({ lookup:true }, presentRelatedObjectModal); presentRelatedObjectModalOnClickOn('a.related-lookup', true);
// django-dynamic-raw-id support - #61
// https://github.com/lincolnloop/django-dynamic-raw-id
presentRelatedObjectModalOnClickOn('a.dynamic_raw_id-related-lookup', true);
}); });
})(django.jQuery); })(django.jQuery);
+4 -10
View File
@@ -40,14 +40,8 @@ https://github.com/fabiocaccamo/django-admin-interface
{# https://github.com/elky/django-flat-responsive#important-note #} {# https://github.com/elky/django-flat-responsive#important-note #}
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive.css' %}?v={{ version }}" /> <link rel="stylesheet" type="text/css" href="{% static 'admin/css/responsive.css' %}?v={{ version }}" />
{% if theme.favicon %} {% include "admin_interface/favicon.html" %}
<link rel="icon" type="image/x-icon" href="{{ theme.favicon.url }}?v={{ version }}" /> {% include "admin_interface/related-modal.html" %}
{% endif %}
{% if theme.related_modal_active %}
<link rel="stylesheet" type="text/css" href="{% static 'admin_interface/magnific-popup/magnific-popup.css' %}?v={{ version }}" />
<script type="text/javascript" src="{% static 'admin_interface/magnific-popup/jquery.magnific-popup.js' %}?v={{ version }}"></script>
<script type="text/javascript" src="{% static 'admin_interface/related-modal/related-modal.js' %}?v={{ version }}"></script>
{% endif %}
{% endblock %} {% endblock %}
{% block bodyclass %}admin-interface flat-theme {% get_admin_interface_theme as theme %}{% if theme.name %}{{ theme.name|slugify }}-theme{% endif %}{% endblock %} {% block bodyclass %}admin-interface flat-theme {% get_admin_interface_theme as theme %}{% if theme.name %}{{ theme.name|slugify }}-theme{% endif %}{% endblock %}
@@ -70,5 +64,5 @@ https://github.com/fabiocaccamo/django-admin-interface
{% block welcome-msg %} {% block welcome-msg %}
{% get_admin_interface_theme as theme %} {% get_admin_interface_theme as theme %}
{% if theme.env_visible %}<span class="enviroment-label {{ theme.env }}"></span> - {% endif %}{{ block.super }}<br> {% if theme.env_visible_in_header %}<span class="environment-label {{ theme.env_name }}"></span> - {% endif %}{{ block.super }}<br>
{% endblock %} {% endblock %}
@@ -1,17 +1,17 @@
.admin-interface #header { .admin-interface #header {
background:{{ theme.css_header_background_color }}; background: {{ theme.css_header_background_color }};
color:{{ theme.css_header_text_color }}; color: {{ theme.css_header_text_color }};
} }
.admin-interface .enviroment-label { .admin-interface .environment-label {
} }
.admin-interface .enviroment-label::before { .admin-interface .environment-label::before {
content: ""; content: "";
display: inline-block; display: inline-block;
width: 8px; width: 8px;
height: 8px; height: 8px;
background-color: #CCCCCC; background-color: {{ theme.env_color }};
border-radius: 100%; border-radius: 100%;
margin-right: 6px; margin-right: 6px;
box-sizing: border-box; box-sizing: border-box;
@@ -19,44 +19,12 @@
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
} }
.admin-interface .enviroment-label.development::before { .admin-interface .environment-label::after {
background-color: #e74c3c; content: "{{ theme.env_name }}";
}
.admin-interface .enviroment-label.testing::before {
background-color: #e67e22;
}
.admin-interface .enviroment-label.staging::before {
background-color: #f1c40f;
}
.admin-interface .enviroment-label.production::before {
background-color: #2ecc71;
}
.admin-interface .enviroment-label::after {
content: "";
}
.admin-interface .enviroment-label.development::after {
content: "development";
}
.admin-interface .enviroment-label.testing::after {
content: "testing";
}
.admin-interface .enviroment-label.staging::after {
content: "staging";
}
.admin-interface .enviroment-label.production::after {
content: "production";
} }
.admin-interface #branding h1 { .admin-interface #branding h1 {
color:{{ theme.title_color }}; color: {{ theme.title_color }};
} }
.admin-interface #branding h1 .logo.default { .admin-interface #branding h1 .logo.default {
@@ -286,4 +254,4 @@
{% if theme.css_module_rounded_corners %} {% if theme.css_module_rounded_corners %}
border-radius:4px; border-radius:4px;
{% endif %} {% endif %}
} }
@@ -3,38 +3,56 @@ related modal + magnific popup customization
https://github.com/dimsemenov/Magnific-Popup https://github.com/dimsemenov/Magnific-Popup
*/ */
.admin-interface .related-modal.mfp-bg { .admin-interface .related-modal.mfp-bg {
background-color:{{ theme.related_modal_background_color }}; background-color: {{ theme.related_modal_background_color }};
opacity: {{ theme.related_modal_background_opacity }}; opacity: {{ theme.related_modal_background_opacity }};
} }
.admin-interface .related-modal .mfp-content { .admin-interface .related-modal .mfp-content {
height: 100%; height: 100%;
overflow: hidden;
{% if theme.related_modal_rounded_corners %}
border-radius: 4px;
{% endif %}
-webkit-box-shadow: 0px 5px 30px 0px rgba(0,0,0,0.2); -webkit-box-shadow: 0px 5px 30px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 5px 30px 0px rgba(0,0,0,0.2); -moz-box-shadow: 0px 5px 30px 0px rgba(0,0,0,0.2);
box-shadow: 0px 5px 30px 0px rgba(0,0,0,0.2); box-shadow: 0px 5px 30px 0px rgba(0,0,0,0.2);
} }
.admin-interface .related-modal .mfp-container { .admin-interface .related-modal .mfp-container {
padding: 90px 90px 90px 90px; padding: 80px 80px 80px 80px;
} }
.admin-interface .related-modal__nested .mfp-container { .admin-interface .related-modal__nested .mfp-container {
padding: 30px 60px 30px 60px; padding: 40px 80px 40px 80px;
} }
@media (max-width:640px){ @media (max-width:640px){
.admin-interface .related-modal .mfp-container { .admin-interface .related-modal .mfp-container {
padding: 60px 15px 60px 15px; padding: 80px 20px 80px 20px;
} }
.admin-interface .related-modal__nested .mfp-container { .admin-interface .related-modal__nested .mfp-container {
padding: 30px 30px 30px 30px; padding: 40px 40px 40px 40px;
} }
} }
@media (max-height:640px){
.admin-interface .related-modal .mfp-container {
padding-top: 20px;
padding-bottom: 20px;
}
.admin-interface .related-modal__nested .mfp-container {
padding: 40px 40px 40px 40px;
}
}
.admin-interface .related-modal .related-modal-iframe-container {
display: block;
width: 100%;
height: 100%;
position: relative;
z-index: 100;
overflow: hidden;
{% if theme.related_modal_rounded_corners %}
border-radius: 4px;
{% endif %}
}
.admin-interface .related-modal #related-modal-iframe { .admin-interface .related-modal #related-modal-iframe {
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -47,4 +65,20 @@ https://github.com/dimsemenov/Magnific-Popup
margin: 0 auto; margin: 0 auto;
padding: 0; padding: 0;
display: block; display: block;
} }
.admin-interface .related-modal .mfp-close {
width: 40px;
height: 40px;
opacity: 1.0;
color: rgba(0, 0, 0, 0.4);
{% if not theme.related_modal_close_button_visible %}
display: none;
{% endif %}
}
.admin-interface .related-modal .mfp-close:hover,
.admin-interface .related-modal .mfp-close:active {
color: rgba(0, 0, 0, 0.6);
top: 0;
}
@@ -10,4 +10,3 @@
</select> </select>
</div> </div>
</div> </div>
@@ -0,0 +1,17 @@
{% load static %}
{% if theme.favicon %}
<link rel="icon" type="image/x-icon" href="{{ theme.favicon.url }}?v={{ version }}" />
{% if theme.env_visible_in_favicon %}
<script type="text/javascript" src="{% static 'admin_interface/favico/favico-0.3.10-patched.min.js' %}?v={{ version }}"></script>
<script type="text/javascript">
var favicon = new Favico({
type: 'circle',
bgColor: '{{ theme.env_color }}',
textColor: '#FFFFFF',
animation: 'none'
});
favicon.badge(' ');
</script>
{% endif %}
{% endif %}
@@ -0,0 +1,7 @@
{% load static %}
{% if theme.related_modal_active %}
<link rel="stylesheet" type="text/css" href="{% static 'admin_interface/magnific-popup/magnific-popup.css' %}?v={{ version }}" />
<script type="text/javascript" src="{% static 'admin_interface/magnific-popup/jquery.magnific-popup.js' %}?v={{ version }}"></script>
<script type="text/javascript" src="{% static 'admin_interface/related-modal/related-modal.js' %}?v={{ version }}"></script>
{% endif %}
@@ -2,6 +2,7 @@
from django import template, VERSION from django import template, VERSION
from admin_interface.cache import get_cached_active_theme, set_cached_active_theme
from admin_interface.models import Theme from admin_interface.models import Theme
from admin_interface.version import __version__ from admin_interface.version import __version__
@@ -15,18 +16,10 @@ else:
@simple_tag(takes_context=True) @simple_tag(takes_context=True)
def get_admin_interface_theme(context): def get_admin_interface_theme(context):
theme = None theme = get_cached_active_theme()
request = context.get('request', None)
if request:
theme = getattr(request, 'admin_interface_theme', None)
if not theme: if not theme:
theme = Theme.get_active_theme() theme = Theme.get_active_theme()
set_cached_active_theme(theme)
if request:
request.admin_interface_theme = theme
return theme return theme
+1 -1
View File
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__version__ = '0.9.2' __version__ = '0.10.5'
+1
View File
@@ -47,6 +47,7 @@ setup(
'Framework :: Django :: 1.11', 'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0', 'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1', 'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License', 'License :: OSI Approved :: MIT License',
'Natural Language :: English', 'Natural Language :: English',
+46
View File
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
from django.core.management import call_command
from django.test import TestCase
from admin_interface.models import Theme
class AdminInterfaceFixturesTestCase(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def __load_theme(self, theme_name):
call_command('loaddata', 'admin_interface_theme_%s.json' % (theme_name, ))
def test_import_all(self):
self.__load_theme('django')
self.__load_theme('bootstrap')
self.__load_theme('foundation')
self.__load_theme('uswds')
self.assertEqual(Theme.objects.count(), 4);
def test_import_idempotency(self):
self.__load_theme('django')
self.__load_theme('django')
self.__load_theme('django')
self.__load_theme('django')
self.__load_theme('django')
self.assertEqual(Theme.objects.count(), 1);
self.__load_theme('bootstrap')
self.__load_theme('bootstrap')
self.__load_theme('bootstrap')
self.assertEqual(Theme.objects.count(), 2);
def test_import_override(self):
obj1 = Theme.get_active_theme()
obj1.title = 'Custom 1'
obj1.save()
self.__load_theme('django')
obj2 = Theme.get_active_theme()
self.assertEqual(obj1.pk, obj2.pk)
self.assertTrue(obj1.title != obj2.title)
+1 -44
View File
@@ -2,29 +2,20 @@
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import TestCase
from django.test.client import RequestFactory
from django.template import Context, Template
import random import random
import shutil import shutil
from admin_interface.models import Theme from admin_interface.models import Theme
from admin_interface.templatetags import admin_interface_tags as templatetags
from admin_interface.version import __version__
class AdminInterfaceTestCase(TestCase): class AdminInterfaceModelsTestCase(TestCase):
def setUp(self): def setUp(self):
self.request_factory = RequestFactory()
pass pass
def tearDown(self): def tearDown(self):
shutil.rmtree(settings.MEDIA_ROOT, ignore_errors=True) shutil.rmtree(settings.MEDIA_ROOT, ignore_errors=True)
pass
def __render_template(self, string, context=None):
return Template(string).render(Context(context or {}))
def __test_active_theme(self): def __test_active_theme(self):
theme = Theme.get_active_theme() theme = Theme.get_active_theme()
@@ -93,40 +84,6 @@ class AdminInterfaceTestCase(TestCase):
self.assertEqual(Theme.get_active_theme().pk, theme.pk) self.assertEqual(Theme.get_active_theme().pk, theme.pk)
self.__test_active_theme() self.__test_active_theme()
def test_templatetags_get_theme(self):
Theme.objects.all().delete()
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)
self.assertEqual(rendered, 'Django')
def test_templatetags_get_theme_with_request(self):
Theme.objects.all().delete()
context = Context({
'request': self.request_factory.get('/')
})
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): def test_repr(self):
theme = Theme.get_active_theme() theme = Theme.get_active_theme()
self.assertEqual('{0}'.format(theme), 'Django') self.assertEqual('{0}'.format(theme), 'Django')
+54
View File
@@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.test.client import RequestFactory
from django.template import Context, Template
from admin_interface.models import Theme
from admin_interface.templatetags import admin_interface_tags as templatetags
from admin_interface.version import __version__
class AdminInterfaceTemplateTagsTestCase(TestCase):
def setUp(self):
self.request_factory = RequestFactory()
def tearDown(self):
pass
def __render_template(self, string, context=None):
return Template(string).render(Context(context or {}))
def test_get_theme(self):
Theme.objects.all().delete()
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)
self.assertEqual(rendered, 'Django')
def test_get_theme_with_request(self):
Theme.objects.all().delete()
context = Context({
'request': self.request_factory.get('/')
})
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_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__)
+4 -3
View File
@@ -2,9 +2,9 @@
envlist = envlist =
py27-{dj17,dj18,dj19,dj110,dj111}-{sqlite,postgres}, py27-{dj17,dj18,dj19,dj110,dj111}-{sqlite,postgres},
py34-{dj17,dj18,dj19,dj110,dj111,dj20}-{sqlite,postgres}, py34-{dj17,dj18,dj19,dj110,dj111,dj20}-{sqlite,postgres},
py35-{dj18,dj19,dj110,dj111,dj20,dj21}-{sqlite,postgres}, py35-{dj18,dj19,dj110,dj111,dj20,dj21,dj22}-{sqlite,postgres},
py36-{dj18,dj19,dj110,dj111,dj20,dj21,djmaster}-{sqlite,postgres}, py36-{dj18,dj19,dj110,dj111,dj20,dj21,dj22,djmaster}-{sqlite,postgres},
py37-{dj20,dj21,djmaster}-{sqlite,postgres}, py37-{dj20,dj21,dj22,djmaster}-{sqlite,postgres},
[testenv] [testenv]
passenv = CI TRAVIS TRAVIS_* passenv = CI TRAVIS TRAVIS_*
deps = deps =
@@ -15,6 +15,7 @@ deps =
dj111: Django >= 1.11, < 1.12 dj111: Django >= 1.11, < 1.12
dj20: Django >= 2.0, < 2.1 dj20: Django >= 2.0, < 2.1
dj21: Django >= 2.1, < 2.2 dj21: Django >= 2.1, < 2.2
dj22: Django >= 2.2, < 2.3
djmaster: https://github.com/django/django/archive/master.tar.gz djmaster: https://github.com/django/django/archive/master.tar.gz
# mysql: mysqlclient # mysql: mysqlclient
postgres: psycopg2-binary postgres: psycopg2-binary