diff --git a/RIGS/models.py b/RIGS/models.py index 18238a03..a292e526 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -1,4 +1,3 @@ -import datetime import hashlib import random import string @@ -77,7 +76,7 @@ def admins(cls): @classmethod def users_awaiting_approval_count(cls): # last_login = None ensures we only pick up genuinely new users, not those that have been deactivated for inactivity - return Profile.objects.filter(is_approved=False, last_login=None).count() + return Profile.objects.filter(is_approved=False, last_login=None, date_joined_date=timezone.now().date()).count() def __str__(self): return self.name diff --git a/RIGS/signals.py b/RIGS/signals.py index 46793c71..b17e751c 100644 --- a/RIGS/signals.py +++ b/RIGS/signals.py @@ -3,6 +3,7 @@ import urllib.parse import urllib.request from io import BytesIO +import datetime from PyPDF2 import PdfFileReader, PdfFileMerger from django.conf import settings @@ -110,7 +111,7 @@ def send_admin_awaiting_approval_email(user, request, **kwargs): if admin.last_emailed is None or admin.last_emailed + settings.EMAIL_COOLDOWN <= timezone.now(): context = { 'request': request, - 'link_suffix': reverse("admin:RIGS_profile_changelist") + '?is_approved__exact=0', + 'link_suffix': reverse("admin:RIGS_profile_changelist") + f'?is_approved__exact=0&date_joined__date={timezone.now().date()}', 'number_of_users': models.Profile.users_awaiting_approval_count(), 'to_name': admin.first_name }