Skip to content

Instantly share code, notes, and snippets.

@ychennay
Last active March 22, 2020 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ychennay/7d19e5351e47336f365a5be69e09b569 to your computer and use it in GitHub Desktop.
Save ychennay/7d19e5351e47336f365a5be69e09b569 to your computer and use it in GitHub Desktop.
class Exclusion(models.Model):
"""
Models a period of time we wish to exclude a particular student from being included in some data report.
"""
student = models.ForeignKey(Student, on_delete=models.CASCADE)
start = models.DateField("exclusion_start")
end = models.DateField("exclusion_end")
active = models.BooleanField(verbose_name="Still send digital communications.", default=True)
def __str__(self):
return f"Exclusion for {self.student}"
class Report(models.Model):
exclusion = models.OneToOneField(Exclusion, on_delete=models.CASCADE)
name = models.CharField(blank=True, null=True, max_length=100)
def __str__(self):
return f"{self.name} report for {self.exclusion.student}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment