Added enviroment display and customization
parent
6e57cf558c
commit
e579134152
|
|
@ -15,6 +15,13 @@ class ThemeAdmin(admin.ModelAdmin):
|
|||
'classes': ('wide', ),
|
||||
'fields': ('name', 'active', )
|
||||
}),
|
||||
('Enviroment', {
|
||||
'classes': ('wide', ),
|
||||
'fields': (
|
||||
'env',
|
||||
'env_visible',
|
||||
)
|
||||
}),
|
||||
('Logo', {
|
||||
'classes': ('wide', ),
|
||||
'fields': (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11 on 2018-01-31 11:00
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('admin_interface', '0008_change_related_modal_background_opacity_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='theme',
|
||||
name='env',
|
||||
field=models.CharField(choices=[('development', 'Development'), ('testing', 'Testing'), ('staging', 'Staging'), ('production', 'Production')], default='development', max_length=50, verbose_name='enviroment'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='theme',
|
||||
name='env_visible',
|
||||
field=models.BooleanField(default=True, verbose_name='visible'),
|
||||
),
|
||||
]
|
||||
|
|
@ -73,6 +73,19 @@ class Theme(models.Model):
|
|||
upload_to='admin-interface/favicon/', blank=True,
|
||||
help_text='(.ico|.png|.gif - 16x16|32x32 px)', verbose_name='favicon')
|
||||
|
||||
env_choices = (
|
||||
('development', 'Development', ),
|
||||
('testing', 'Testing', ),
|
||||
('staging', 'Staging', ),
|
||||
('production', 'Production', ),
|
||||
)
|
||||
env = models.CharField(
|
||||
max_length=50,
|
||||
choices=env_choices,
|
||||
default='development', verbose_name='enviroment')
|
||||
env_visible = models.BooleanField(
|
||||
default=True, verbose_name='visible')
|
||||
|
||||
css_header_background_color = ColorField(
|
||||
blank=True, default='#0C4B33', help_text='#0C4B33',
|
||||
max_length=10, verbose_name='background color')
|
||||
|
|
|
|||
|
|
@ -64,4 +64,9 @@ https://github.com/fabiocaccamo/django-admin-interface
|
|||
<span>{% if theme.title %}{% trans theme.title %}{% else %}{% trans 'Django administration' %}{% endif %}</span>
|
||||
{% endif %}
|
||||
</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block welcome-msg %}
|
||||
{% get_admin_interface_theme as theme %}
|
||||
{% if theme.env_visible %}<span class="enviroment-label {{ theme.env }}"></span> - {% endif %}{{ block.super }}<br>
|
||||
{% endblock %}
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue