|
16 | 16 | from ietf.liaisons.models import LiaisonStatement, LiaisonStatementPurposeName |
17 | 17 | from ietf.liaisons.proxy import LiaisonDetailProxy |
18 | 18 | from ietf.group.models import Group |
19 | | -from ietf.person.models import Person |
| 19 | +from ietf.person.models import Person, Email |
20 | 20 | from ietf.doc.models import Document |
21 | 21 |
|
22 | 22 |
|
@@ -313,6 +313,14 @@ def set_from_field(self): |
313 | 313 | self.fields['from_field'].choices = [('sdo_%s' % i.pk, i.name) for i in sdos.order_by("name")] |
314 | 314 | self.fields['from_field'].widget.submitter = unicode(self.person) |
315 | 315 |
|
| 316 | + def set_replyto_field(self): |
| 317 | + e = Email.objects.filter(person=self.person, role__group__state="active", role__name__in=["liaiman", "auth"]) |
| 318 | + if e: |
| 319 | + addr = e[0].address |
| 320 | + else: |
| 321 | + addr = self.person.email_address() |
| 322 | + self.fields['replyto'].initial = addr |
| 323 | + |
316 | 324 | def set_organization_field(self): |
317 | 325 | self.fields['organization'].choices = self.hm.get_all_incoming_entities() |
318 | 326 |
|
@@ -360,6 +368,14 @@ def set_from_field(self): |
360 | 368 | self.fields['from_field'].widget.submitter = unicode(self.person) |
361 | 369 | self.fieldsets[0] = ('From', ('from_field', 'replyto', 'approved')) |
362 | 370 |
|
| 371 | + def set_replyto_field(self): |
| 372 | + e = Email.objects.filter(person=self.person, role__group__state="active", role__name__in=["ad", "chair"]) |
| 373 | + if e: |
| 374 | + addr = e[0].address |
| 375 | + else: |
| 376 | + addr = self.person.email_address() |
| 377 | + self.fields['replyto'].initial = addr |
| 378 | + |
363 | 379 | def set_organization_field(self): |
364 | 380 | # If the user is a liaison manager and is nothing more, reduce the To field to his SDOs |
365 | 381 | if not self.hm.get_entities_for_person(self.person) and is_sdo_liaison_manager(self.person): |
|
0 commit comments