aboutsummaryrefslogtreecommitdiffstats
path: root/api/models.py
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-01-27 12:31:23 +0100
committerGravatar Johannes Christ <[email protected]>2019-01-27 12:31:23 +0100
commit2b2c81ad4a54d94a69bb761da968d6eb2dc1c9d3 (patch)
treec4899f7a42097585cc7a8142383f97a5e1abbc3e /api/models.py
parentAdd an API endpoint for reminders. (diff)
Implement a simple nominations API.
Diffstat (limited to 'api/models.py')
-rw-r--r--api/models.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/api/models.py b/api/models.py
index 5ca274ce..fa68f31c 100644
--- a/api/models.py
+++ b/api/models.py
@@ -408,3 +408,32 @@ class Reminder(ModelReprMixin, models.Model):
def __str__(self):
return f"{self.content} on {self.expiration} by {self.author}"
+
+
+class Nomination(ModelReprMixin, models.Model):
+ """A helper nomination created by staff."""
+
+ active = models.BooleanField(
+ default=True,
+ help_text="Whether this nomination is still relevant."
+ )
+ author = models.ForeignKey(
+ User,
+ on_delete=models.CASCADE,
+ help_text="The staff member that nominated this user.",
+ related_name='nomination_set'
+ )
+ reason = models.TextField(
+ help_text="Why this user was nominated."
+ )
+ user = models.OneToOneField(
+ User,
+ on_delete=models.CASCADE,
+ help_text="The nominated user.",
+ primary_key=True,
+ related_name='nomination'
+ )
+ inserted_at = models.DateTimeField(
+ auto_now_add=True,
+ help_text="The creation date of this nomination."
+ )