def __init__(self, user, *args, **kwargs): """Constructor for override especially on fly data.""" self.user = user super(SettingsForm, self).__init__(*args, **kwargs) org_units = get_specific_orgs(self.user.reg_person_id) # clusters list cluster_list = get_clusters(self.user, "Please Select Cluster") if user.is_superuser: org_units = get_org_units_list('Please select Unit') org_unit = forms.ChoiceField(choices=org_units, initial='', widget=forms.Select( attrs={ 'class': 'form-control', 'data-parsley-required': 'false', 'autofocus': 'true' })) self.fields['org_unit'] = org_unit cluster = forms.ChoiceField(choices=cluster_list, widget=forms.Select( attrs={ 'class': 'form-control', 'data-parsley-required': 'false', 'autofocus': 'true' })) self.fields['cluster'] = cluster
def __init__(self, user, *args, **kwargs): """Constructor for override especially on fly data.""" self.user = user super(CaseLoad, self).__init__(*args, **kwargs) org_units = get_specific_orgs(self.user.reg_person_id) org_inst = get_specific_orgs(self.user.reg_person_id, 1) # clusters cluster_list = get_clusters(self.user) if user.is_superuser: org_units = get_org_units_list('Please select Unit') inst_types = ['TNRH', 'TNRB', 'TNRR', 'TNRS', 'TNAP', 'TNRC'] org_inst = get_org_units_list('Please select Unit', inst_types) org_unit = forms.ChoiceField( choices=org_units, initial='', widget=forms.Select(attrs={ 'class': 'form-control', 'autofocus': 'true' })) self.fields['org_unit'] = org_unit org_inst = forms.ChoiceField( choices=org_inst, initial='', widget=forms.Select(attrs={ 'class': 'form-control', 'autofocus': 'true', 'id': 'id_org_unit' })) self.fields['org_inst'] = org_inst cluster = forms.ChoiceField(choices=cluster_list, widget=forms.Select( attrs={ 'class': 'form-control', 'data-parsley-required': 'false', 'autofocus': 'true' })) self.fields['cluster'] = cluster
def __init__(self, user, *args, **kwargs): """Override method especially for dynamic lookup data.""" self.user = user super(ClusterForm, self).__init__(*args, **kwargs) org_units_list = get_specific_orgs(self.user.reg_person_id) if user.is_superuser: org_units_list = get_org_units_list('Please select Unit') cbo_unit_id = forms.MultipleChoiceField( choices=org_units_list, initial='', widget=forms.SelectMultiple( attrs={'class': 'form-control', 'data-parsley-required': 'true', 'id': 'cbo'})) self.fields['cbo'] = cbo_unit_id
('3', 'CHV'), ('4', 'CBO'), ('5', 'Caregiver')) immunization_list = get_list('immunization_status_id', 'Please Select') person_type_list = get_list('person_type_id', 'Please Select Type') school_level_list = get_list('school_level_id', 'Please Select Level') hiv_status_list = get_list('hiv_status_id', 'Please Select HIV Status') alive_status_list = get_list('yesno_id', '') art_status_list = get_list('art_status_id', 'Please Select Status') ovc_form_type_list = get_list('ovc_form_type_id', 'Please Select') eligibility_list = get_list('eligibility_criteria_id', '') death_cause_list = get_list('death_cause_id', 'Please Select Cause of Death') exit_list = get_list('exit_reason_id', 'Please Select one') admission_list = get_list('school_type_id', 'Please Select one') health_unit_list = get_org_units_list(default_txt='Select Unit', org_types=['HFGU']) class OVCSearchForm(forms.Form): """Search registry form.""" search_name = forms.CharField(widget=forms.TextInput( attrs={ 'placeholder': _('Search . . .'), 'class': 'form-control', 'id': 'search_name', 'data-parsley-minlength': '3', 'data-parsley-required': 'true' })) search_criteria = forms.ChoiceField(
def __init__(self, user, *args, **kwargs): """Override method especially for dynamic lookup data.""" self.user = user super(RegistrationForm, self).__init__(*args, **kwargs) org_units_list = get_specific_orgs(self.user.reg_person_id) chv_list = get_chvs(self.user.reg_person_id) if user.is_superuser: org_units_list = get_org_units_list('Please select Unit') org_unit_id = forms.ChoiceField( choices=org_units_list, initial='', widget=forms.Select(attrs={ 'class': 'form-control', 'id': 'org_unit_id' })) cbo_unit_id = forms.ChoiceField( choices=org_units_list, initial='', widget=forms.Select(attrs={ 'class': 'form-control', 'id': 'cbo_unit_id' })) chv_unit_id = forms.ChoiceField( choices=chv_list, initial='', widget=forms.Select(attrs={ 'class': 'form-control', 'id': 'chv_unit_id' })) self.fields['org_unit_id'] = org_unit_id self.fields['cbo_unit_id'] = cbo_unit_id self.fields['chv_unit_id'] = chv_unit_id self.chvs = chv_list # All working in selections need to be tied to currently logged in user user_geos = get_user_geos(self.user) print user_geos county_filter = [] if user.is_superuser else user_geos['counties'] scounty_filter = [] if user.is_superuser else user_geos['sub_counties'] ward_filter = [] if user.is_superuser else user_geos['wards'] county_list = get_geo_list(all_list, 'GPRV', user_filter=county_filter) sub_county_list = get_geo_list(all_list, 'GDIS', user_filter=scounty_filter) ward_list = get_geo_list(all_list, 'GWRD', user_filter=ward_filter) working_in_county = forms.MultipleChoiceField( choices=county_list, initial='', widget=forms.SelectMultiple(attrs={ 'class': 'form-control', 'id': 'working_in_county' })) self.fields['working_in_county'] = working_in_county working_in_subcounty = forms.MultipleChoiceField( choices=sub_county_list, initial='', widget=forms.SelectMultiple( attrs={ 'class': 'form-control', 'id': 'working_in_subcounty', 'data-parsley-required': 'true' })) self.fields['working_in_subcounty'] = working_in_subcounty working_in_ward = forms.MultipleChoiceField( choices=ward_list, label=_('Select ward'), initial='', widget=forms.SelectMultiple(attrs={ 'id': 'working_in_ward', 'class': 'form-control' })) self.fields['working_in_ward'] = working_in_ward
from cpovc_main.country import OCOUNTRIES from cpovc_access.forms import StrictSetPasswordForm my_list = [] for country in OCOUNTRIES: my_list.append((country, OCOUNTRIES[country])) country_list = list(my_list) person_type_list = get_list('person_type_id', 'Please Select') org_unit_type_list = get_list('org_unit_type_id', 'Please Select') relationship_type_list = get_list('relationship_type_id', 'Please Select') external_id_list = get_list('identifier_type_id', 'Please Select') cadre_type_list = get_list('cadre_type_id', 'Please Select') sex_id_list = get_list('sex_id', 'Please Select') psearch_criteria_list = get_list('psearch_criteria_type_id', 'Select Criteria') org_units_list = get_org_units_list('Please select Unit') classes_list = get_list('class_level_id', 'Please Select') all_list = get_all_geo_list() county_list = get_geo_list(all_list, 'GPRV') sub_county_list = get_geo_list(all_list, 'GDIS') ward_list = get_geo_list(all_list, 'GWRD') YESNO_CHOICES = get_list('yesno_id') # org_unit_type_id reg_list = get_list('organisation_type_id', 'Select unit type') reg_type = get_list('identifier_type_id', 'Select registration type', 'Organisational unit ID - external') org_units = get_org_units()