mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-17 05:28:03 +00:00
Deliver True/False for max_emails via context processor to all templates
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user