diff --git a/smash/web/forms/worker_form.py b/smash/web/forms/worker_form.py index 0321c7bf3e38cb5738b0806cfd9bf197d96334dd..bcbb40cac27b27182c78ab0243146d7cebec4b34 100644 --- a/smash/web/forms/worker_form.py +++ b/smash/web/forms/worker_form.py @@ -9,7 +9,7 @@ from django_common.auth_backends import User from web.models import Worker, WorkerStudyRole from web.models.constants import GLOBAL_STUDY_ID from web.models.worker import role_choices_by_worker_type, worker_type_by_worker -from web.models.worker_study_role import WORKER_STAFF, WORKER_VOUCHER_PARTNER +from web.models.worker_study_role import WORKER_STAFF, WORKER_VOUCHER_PARTNER, WORKER_HEALTH_PARTNER logger = logging.getLogger(__name__) @@ -33,7 +33,11 @@ class WorkerForm(ModelForm): initial_role = roles[0].role choices = role_choices_by_worker_type(worker_type) - self.fields['role'] = forms.ChoiceField(label='Role', choices=choices) + if worker_type in [WORKER_VOUCHER_PARTNER, WORKER_HEALTH_PARTNER]: + self.fields['role'] = forms.ChoiceField(label='Role', choices=choices, widget=forms.HiddenInput(), required=False) + else: + self.fields['role'] = forms.ChoiceField(label='Role', choices=choices) + self.fields['role'].initial = initial_role del self.fields['user'] diff --git a/smash/web/templates/doctors/add.html b/smash/web/templates/doctors/add.html index 88be6696b6e91e93bd4bdb96d480ac386e9e9019..ad00fa2545f2a83a4bbcb682ab4f378280cb7972 100644 --- a/smash/web/templates/doctors/add.html +++ b/smash/web/templates/doctors/add.html @@ -27,7 +27,7 @@ <div class="box-body"> <div class="col-sm-6"> - {% for field in form %} + {% for field in form.visible_fields %} <div class="form-group {% if field.errors %}has-error{% endif %}"> <label for="{# TODO #}" class="col-sm-4 control-label"> {{ field.label }}