Allow CID users to request details by email

This commit is contained in:
Ross
2023-01-09 13:03:02 +00:00
parent fbaa4b0027
commit 8c8f305f33
6 changed files with 47 additions and 3 deletions
+15 -1
View File
@@ -1,4 +1,5 @@
from collections import defaultdict
from typing import Tuple
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db import models
from django.http import HttpRequest
@@ -544,6 +545,10 @@ class CidUser(models.Model):
html_msg = f""""""
def email_results(self, resend=False, additional_emails=[]):
"""Emails a CID candidate results (internal candidates)
***DEPRECATED***
"""
if not self.internal_candidate:
return False, "Not internal candidate."
@@ -574,12 +579,21 @@ class CidUser(models.Model):
self.save()
return True, ""
def email_details(self, resend=False):
def email_details(self, resend: bool=False) -> Tuple[bool, str]:
"""Email candidate details to the CID user
Args:
resend (bool, optional): Force sending details (even if sent previously). Defaults to False.
Returns:
Tuple[bool, str]: Tuple containing the email status and any error message
"""
if self.login_email_sent and not resend:
return False, "Already sent."
login_url = reverse("cid_selector")
msg = f"""
See below for your details for: {self.group}