From a59d086bf946a2b0fa19e485af3369c2af5b56a7 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sat, 8 Jan 2022 20:37:24 +0100 Subject: [PATCH] personal: Add status and special_functions to Contact --- mpicms/personal/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mpicms/personal/models.py b/mpicms/personal/models.py index bbf9e55..6c1d657 100644 --- a/mpicms/personal/models.py +++ b/mpicms/personal/models.py @@ -128,6 +128,8 @@ class Contact(index.Indexed, ClusterableModel): priority = models.PositiveSmallIntegerField( _("priority"), blank=True, default=0, validators=[MaxValueValidator(999)], help_text=_("Priority from 0-999 to determine the sorting order.")) + status = models.ForeignKey(Status, on_delete=models.SET_NULL, blank=True, null=True) + special_functions = models.ManyToManyField(SpecialFunction, blank=True) objects = ContactManager() @@ -138,9 +140,12 @@ class Contact(index.Indexed, ClusterableModel): FieldPanel('last_name'), FieldPanel('academic_suffix'), ], heading='Name'), + FieldPanel('status'), InlinePanel( 'positions', label="Positions", - panels=None), + panels=None + ), + FieldPanel('special_functions'), FieldPanel('email'), FieldPanel('phone'), FieldPanel('room'), @@ -213,7 +218,7 @@ class WrittenConsent(models.Model): ref = models.CharField("ID", max_length=10, unique=True) comment = models.TextField("comment", blank=True) valid = models.BooleanField(_("valid"), default=True) - contacts = models.ManyToManyField(Contact, blank = True) + contacts = models.ManyToManyField(Contact, blank=True) def __str__(self): return "Written Consent #" + self.ref + " (" + ", ".join(str(c) for c in self.contacts.all()) + ")"