Deliver True/False for max_emails via context processor to all templates

This commit is contained in:
Oliver Falk
2018-07-11 15:03:32 +02:00
parent 20018cbf9f
commit d5bf6de435

View File

@@ -5,6 +5,7 @@ Default: useful variables for the base page templates.
from ipware import get_client_ip
from ivatar.settings import IVATAR_VERSION, SITE_NAME, MAX_PHOTO_SIZE
from ivatar.settings import BASE_URL, SECURE_BASE_URL
from ivatar.settings import MAX_NUM_UNCONFIRMED_EMAILS
def basepage(request):
'''
@@ -23,4 +24,10 @@ def basepage(request):
context['max_file_size'] = MAX_PHOTO_SIZE
context['BASE_URL'] = BASE_URL
context['SECURE_BASE_URL'] = SECURE_BASE_URL
context['max_emails'] = False
if request.user:
unconfirmed = request.user.unconfirmedemail_set.count()
if unconfirmed >= MAX_NUM_UNCONFIRMED_EMAILS:
context['max_emails'] = True
return context