@@ -31,7 +31,7 @@ class LiaisonForm(forms.Form):
3131 response_contacts = forms .CharField (label = u'Response contacts' )
3232 organization = forms .ChoiceField ()
3333 to_poc = forms .CharField (widget = ReadOnlyWidget , label = "POC" , required = False )
34- technical_contact = forms .CharField (required = False , max_length = 255 )
34+ technical_contacts = forms .CharField (required = False , max_length = 255 )
3535 cc1 = forms .CharField (widget = forms .Textarea , label = "CC" , required = False , help_text = 'Please insert one email address per line' )
3636 purpose = forms .ChoiceField ()
3737 deadline_date = forms .DateField (label = 'Deadline' )
@@ -50,7 +50,7 @@ class LiaisonForm(forms.Form):
5050
5151 fieldsets = [('From' , ('from_field' , 'response_contacts' )),
5252 ('To' , ('organization' , 'to_poc' )),
53- ('Other email addresses' , ('technical_contact ' , 'cc1' )),
53+ ('Other email addresses' , ('technical_contacts ' , 'cc1' )),
5454 ('Purpose' , ('purpose' , 'deadline_date' )),
5555 ('References' , ('related_to' , )),
5656 ('Liaison Statement' , ('title' , 'submitted_date' , 'body' , 'attachments' )),
@@ -76,16 +76,15 @@ def __init__(self, user, *args, **kwargs):
7676 if self .instance :
7777 self .initial ["person" ] = self .instance .from_contact .person_id if self .instance .from_contact else None
7878 self .initial ["response_contacts" ] = self .instance .response_contacts
79- self .initial ["to_poc" ] = self .instance .to_contact
80- self .initial ["technical_contact" ] = self .instance .technical_contact
81- self .initial ["cc1" ] = self .instance .cc
79+ self .initial ["technical_contacts" ] = self .instance .technical_contacts
80+ self .initial ["cc1" ] = self .instance .cc_contacts
8281 self .initial ["purpose" ] = self .instance .purpose .order
8382 self .initial ["deadline_date" ] = self .instance .deadline
8483 self .initial ["submitted_date" ] = self .instance .submitted .date () if self .instance .submitted else None
8584 self .initial ["title" ] = self .instance .title
8685 self .initial ["body" ] = self .instance .body
8786 self .initial ["attachments" ] = self .instance .attachments .all ()
88- self .initial ["related_to" ] = self .instance .related_to_id
87+ self .initial ["related_to" ] = [ i . target . id for i in self .instance .source_of_set . all ()]
8988 if "approved" in self .fields :
9089 self .initial ["approved" ] = bool (self .instance .approved )
9190
@@ -167,8 +166,8 @@ def clean_related_to(self):
167166 related_list = self .data .getlist ('related_to' )
168167 return [i for i in related_list if i ]
169168
170- def clean_technical_contact (self ):
171- value = self .cleaned_data .get ('technical_contact ' , None )
169+ def clean_technical_contacts (self ):
170+ value = self .cleaned_data .get ('technical_contacts ' , None )
172171 self .check_email (value )
173172 return value
174173
@@ -224,7 +223,7 @@ def save(self, *args, **kwargs):
224223 l .body = self .cleaned_data ["body" ].strip ()
225224 l .deadline = self .cleaned_data ["deadline_date" ]
226225 l .response_contacts = self .cleaned_data ["response_contacts" ]
227- l .technical_contact = self .cleaned_data ["technical_contact " ]
226+ l .technical_contacts = self .cleaned_data ["technical_contacts " ]
228227
229228 now = datetime .datetime .now ()
230229
@@ -247,9 +246,8 @@ def save_extra_fields(self, liaison):
247246 organization = self .get_to_entity ()
248247 liaison .to_name = organization .name
249248 liaison .to_group = organization .obj
250- liaison .to_contact = self .get_poc (organization )
251249
252- liaison .cc = self .get_cc (from_entity , organization )
250+ liaison .cc_contacts = self .get_cc (from_entity , organization )
253251
254252 def save_attachments (self , instance ):
255253 written = instance .attachments .all ().count ()
@@ -442,7 +440,7 @@ class EditLiaisonForm(LiaisonForm):
442440
443441 class Meta :
444442 fields = ('from_raw_body' , 'to_body' , 'to_poc' , 'cc1' , 'last_modified_date' , 'title' ,
445- 'technical_contact ' , 'body' ,
443+ 'technical_contacts ' , 'body' ,
446444 'deadline_date' , 'purpose' , 'response_contacts' , 'related_to' )
447445
448446 def __init__ (self , * args , ** kwargs ):
@@ -461,8 +459,7 @@ def set_organization_field(self):
461459 def save_extra_fields (self , liaison ):
462460 liaison .from_name = self .cleaned_data .get ('from_field' )
463461 liaison .to_name = self .cleaned_data .get ('organization' )
464- liaison .to_contact = self .cleaned_data ['to_poc' ]
465- liaison .cc = self .cleaned_data ['cc1' ]
462+ liaison .cc_contacts = self .cleaned_data ['cc1' ]
466463
467464def liaison_form_factory (request , ** kwargs ):
468465 user = request .user
0 commit comments