Add missing files
This commit is contained in:
parent
b5d9047dd6
commit
84680bab4f
4 changed files with 38 additions and 0 deletions
23
manager/migrations/0039_auto_20190124_1023.py
Normal file
23
manager/migrations/0039_auto_20190124_1023.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
0
manager/templatetags/__init__.py
Normal file
0
manager/templatetags/__init__.py
Normal file
10
manager/templatetags/notifications.py
Normal file
10
manager/templatetags/notifications.py
Normal 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
|
||||||
|
|
5
templates/manager/notifications.html
Normal file
5
templates/manager/notifications.html
Normal 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 %}
|
Loading…
Reference in a new issue