Add missing files

This commit is contained in:
Kumi 2019-01-24 14:52:55 +01:00
parent b5d9047dd6
commit 84680bab4f
4 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 2.1.5 on 2019-01-24 10:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manager', '0038_auto_20190124_1022'),
]
operations = [
migrations.AddField(
model_name='notification',
name='on_login',
field=models.BooleanField(default=False, verbose_name='Display Notification on Login Screen'),
),
migrations.AlterField(
model_name='device',
name='wifi',
field=models.ManyToManyField(blank=True, to='manager.Wifi'),
),
]

View file

View file

@ -0,0 +1,10 @@
from django import template
from manager.models import Notification
from django.utils import timezone
register = template.Library()
@register.inclusion_tag('manager/notifications.html', takes_context=True)
def getNotifications(context):
return { 'notifications': Notification.objects.filter(expiry__gte = timezone.now()) } # TODO

View file

@ -0,0 +1,5 @@
{% for notification in notifications %}
<div class="alert alert-{% if notification.status == 0 %}info{% elif notification.status == 1 %}warning{% else %}danger{% endif %}">
<strong>{% if notification.status == 0 %}Notice:{% elif notification.status == 1 %}Warning:{% else %}Emergency:{% endif %}</strong> {{ notification.text }}
</div>
{% endfor %}