Liaison managers can not send incoming liaison statements. They only have the 'Post only' option. Fixes #363

- Legacy-Id: 2478
This commit is contained in:
Emilio A. Sánchez López 2010-08-13 12:42:35 +00:00
parent 81bcb7176c
commit e9588d7331
2 changed files with 15 additions and 0 deletions

View file

@ -64,6 +64,9 @@ class LiaisonForm(forms.ModelForm):
def __unicode__(self):
return self.as_div()
def get_post_only(self):
return False
def set_required_fields(self):
purpose = self.data.get('purpose', None)
if purpose == '5':
@ -193,6 +196,16 @@ class IncomingLiaisonForm(LiaisonForm):
def set_organization_field(self):
self.fields['organization'].choices = self.hm.get_all_incoming_entities()
def get_post_only(self):
if self.user.groups.filter(name='Liaison_Manager'):
return True
return False
def clean(self):
if self.data.has_key('send') and self.get_post_only():
self._errors['from_field'] = ErrorList([u'As an IETF Liaison Manager you can not send an incoming liaison statements, you only can post them'])
return super(IncomingLiaisonForm, self).clean()
class OutgoingLiaisonForm(LiaisonForm):

View file

@ -46,7 +46,9 @@
{% if form.liaison %}
<input type="submit" value="Edit" name="edit" />
{% else %}
{% if not form.get_post_only %}
<input type="submit" value="Send and Post" name="send" />
{% endif %}
<input type="submit" value="Post Only" name="post_only" />
{% endif %}
</div>