25 lines
557 B
Python
25 lines
557 B
Python
"""
|
|
Context processor for acknowledgement notifications
|
|
"""
|
|
from apps.accounts.models import EmployeeAcknowledgement
|
|
|
|
|
|
def acknowledgement_counts(request):
|
|
"""
|
|
Add pending acknowledgement count to all templates
|
|
"""
|
|
if not request.user.is_authenticated:
|
|
return {}
|
|
|
|
try:
|
|
pending_count = EmployeeAcknowledgement.objects.filter(
|
|
employee=request.user,
|
|
is_signed=False
|
|
).count()
|
|
except:
|
|
pending_count = 0
|
|
|
|
return {
|
|
'pending_acknowledgements_count': pending_count,
|
|
}
|