File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -266,8 +266,12 @@ def clean_to_groups(self):
266266
267267 def clean_from_contact (self ):
268268 contact = self .cleaned_data .get ('from_contact' )
269+ from_groups = self .cleaned_data .get ('from_groups' )
269270 try :
270271 email = Email .objects .get (address = contact )
272+ if not email .origin :
273+ email .origin = "liaison: %s" % (',' .join ([ g .acronym for g in from_groups .all () ]))
274+ email .save ()
271275 except ObjectDoesNotExist :
272276 raise forms .ValidationError ('Email address does not exist' )
273277 return email
@@ -500,14 +504,6 @@ def set_to_fields(self):
500504 if has_role (self .user , "Liaison Manager" ):
501505 self .fields ['to_groups' ].initial = [queryset .first ()]
502506
503- def save (self , commit = False ):
504- instance = super (EditModelForm , self ).save (commit = False )
505-
506- if 'from_contact' in self .changed_data :
507- email = self .cleaned_data .get ('from_contact' )
508- if not email .origin :
509- email .origin = "liaison: %s" % (',' .join ([ g .acronym for g in instance .from_groups .all () ]))
510- email .save ()
511507
512508class EditLiaisonForm (LiaisonModelForm ):
513509 def __init__ (self , * args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments