From b609de555968116374b007369588a0ebd9864cc4 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sun, 27 Nov 2011 17:49:12 +0100 Subject: [PATCH] Remove submitter field from professional services The rest of the code already dealt with profservs attached to organisations, but the existance of tihs field causded the validation to reject any updates since this field is wrong. Instead, create a verify_submitter() function that checks the permissions on the organisation. This fixes #98 --- pgweb/profserv/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pgweb/profserv/models.py b/pgweb/profserv/models.py index f0a779aa..feebe29a 100644 --- a/pgweb/profserv/models.py +++ b/pgweb/profserv/models.py @@ -5,7 +5,6 @@ from pgweb.core.models import Organisation from pgweb.util.bases import PgModel class ProfessionalService(PgModel, models.Model): - submitter = models.ForeignKey(User, null=False, blank=False) approved = models.BooleanField(null=False, blank=False, default=False) organisation = models.ForeignKey(Organisation, null=False, blank=False, unique=True) @@ -32,6 +31,9 @@ class ProfessionalService(PgModel, models.Model): send_notification = True + def verify_submitter(self, user): + return (len(self.organisation.managers.filter(pk=user.pk)) == 1) + def __unicode__(self): return self.organisation.name -- 2.39.5