Add login screen-only notifications
This commit is contained in:
parent
a0b82c3c97
commit
267bf2b999
2 changed files with 4 additions and 3 deletions
|
@ -1,10 +1,11 @@
|
||||||
from django import template
|
from django import template
|
||||||
from manager.models import Notification
|
from manager.models import Notification
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@register.inclusion_tag('manager/notifications.html', takes_context=True)
|
@register.inclusion_tag('manager/notifications.html', takes_context=True)
|
||||||
def getNotifications(context):
|
def getNotifications(context, login=False):
|
||||||
return { 'notifications': Notification.objects.filter(expiry__gte = timezone.now()), 'context': context } # TODO
|
return { 'notifications': [notification for notification in Notification.objects.filter(Q(expiry__gte = timezone.now()) | Q(expiry = None)) if (notification.on_login or (not login)) ] }
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</div>
|
</div>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
||||||
{% getNotifications %}
|
{% getNotifications True %}
|
||||||
|
|
||||||
{% if wizard.steps.current == 'auth' %}
|
{% if wizard.steps.current == 'auth' %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
|
|
Loading…
Reference in a new issue