示例#1
0
文件: forms.py 项目: I-TECH-UW/mwachx
    def __init__(self, *args, **kwargs):
        super(ContactAddMwachNeo, self).__init__(*args, **kwargs)

        self.fields['due_date'].widget = util.AngularPopupDatePicker(
            {'required': True}, min=3)
        self.fields['birthdate'].widget = util.AngularPopupDatePicker(
            {
                'required': True,
                'datepicker-position-right': True
            },
            max=-5110  # 14 years or older
        )
        # self.fields['clinic_visit'].widget = util.AngularPopupDatePicker({'required': True}, min=7)

        self.helper.layout = Layout(
            Fieldset(
                'Study Information',
                Div(Div('study_id', css_class="col-md-4"),
                    Div('anc_num', css_class="col-md-4"),
                    Div('send_time', css_class="col-md-4"),
                    css_class="row"),
            ),
            Fieldset(
                'Client Information',
                Div(Div('nickname', css_class="col-md-4"),
                    Div('phone_number', css_class="col-md-4"),
                    Div('birthdate', css_class="col-md-4"),
                    css_class="row"),
                Div(Div('language', css_class="col-md-4"), css_class="row"),
                Div(Div('relationship_status', css_class="col-md-4"),
                    Div('partner_name', css_class="col-md-4"),
                    Div('previous_pregnancies', css_class="col-md-4"),
                    css_class="row"),
            ),
            Fieldset(
                'Important Dates',
                Div(
                    Div('due_date', css_class="col-md-6"),
                    # Div('clinic_visit', css_class="col-md-6"),
                    css_class="row")),
            FormActions(Submit('submit',
                               'Enroll Participant',
                               ng_disabled='participantNewForm.$invalid',
                               style='margin-bottom:20px'),
                        css_class="row"))

        # thank you: http://stackoverflow.com/questions/24663564/django-add-attribute-to-every-field-by-default
        for field in self:
            field.field.widget.attrs.update({
                'ng-model':
                'participant.{0}'.format(field.name),
            })
示例#2
0
文件: forms.py 项目: I-TECH-UW/mwachx
    def __init__(self, *args, **kwargs):
        super(ContactUpdateMwachX, self).__init__(*args, **kwargs)

        self.fields['art_initiation'].widget = util.AngularPopupDatePicker(
            max=0)
        self.fields['due_date'].widget = util.AngularPopupDatePicker(min=3,
                                                                     max=280)

        # thank you: http://stackoverflow.com/questions/24663564/django-add-attribute-to-every-field-by-default
        for field in self:
            field.field.widget.attrs.update({
                'ng-model':
                'participant.{0}'.format(field.name),
            })
示例#3
0
文件: forms.py 项目: nyafreddy/mwachx
    def __init__(self, *args, **kwargs):
        super(ContactUpdate, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_id = 'participant-details-form'
        self.helper.label_class = 'col-lg-4'
        self.helper.field_class = 'col-lg-7'

        self.fields['art_initiation'].widget = util.AngularPopupDatePicker(max=0)
        self.fields['due_date'].widget = util.AngularPopupDatePicker(min=3,max=280)

        # thank you: http://stackoverflow.com/questions/24663564/django-add-attribute-to-every-field-by-default
        for field in self:

          field.field.widget.attrs.update({
              'ng-model': 'participant.{0}'.format(field.name),
          })
示例#4
0
文件: forms.py 项目: tperrier/mwachx
    def __init__(self, *args, **kwargs):
        super(ContactAdd, self).__init__(*args, **kwargs)

        self.fields['due_date'].widget = util.AngularPopupDatePicker(
            {'required': True}, min=3)
        self.fields['birthdate'].widget = util.AngularPopupDatePicker(
            {
                'required': True,
                'datepicker-position-right': True
            },
            max=-5110  # 14 years or older
        )
        self.fields['art_initiation'].widget = util.AngularPopupDatePicker(
            max=0)
        self.fields['clinic_visit'].widget = util.AngularPopupDatePicker(
            {'required': True}, min=7)

        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_id = 'participant-details-form'
        self.helper.label_class = 'col-sm-6'
        self.helper.field_class = 'col-sm-6'
        self.helper.form_tag = False

        self.helper.layout = Layout(
            Fieldset(
                'Study Information',
                Div(Div('study_id', css_class="col-md-4"),
                    Div('anc_num', css_class="col-md-4"),
                    Div('study_group', css_class="col-md-4"),
                    css_class="row"),
                Div(
                    Div('ccc_num', css_class="col-md-4"),
                    Div('send_day',
                        css_class="col-md-4",
                        ng_if="participant.study_group != 'control'"),
                    Div('send_time',
                        css_class="col-md-4",
                        ng_if="participant.study_group != 'control'"),
                    css_class="row",
                ),
            ),
            Fieldset(
                'Client Information',
                Div(Div('nickname', css_class="col-md-4"),
                    Div('phone_number', css_class="col-md-4"),
                    Div('birthdate', css_class="col-md-4"),
                    css_class="row"),
                Div(Div('relationship_status', css_class="col-md-4"),
                    Div('partner_name', css_class="col-md-4"),
                    Div('previous_pregnancies', css_class="col-md-4"),
                    css_class="row"),
                Div(Div('language', css_class="col-md-4"),
                    Div('condition', css_class="col-md-4"),
                    css_class="row"),
            ),
            Fieldset(
                'Disclosure and Consent',
                Div(Div('hiv_disclosed', css_class="col-md-4"),
                    Div('phone_shared', css_class="col-md-4"),
                    Div('hiv_messaging', css_class="col-md-4"),
                    css_class="row")),
            Fieldset(
                'Important Dates',
                Div(Div('art_initiation', css_class="col-md-4"),
                    Div('due_date', css_class="col-md-4"),
                    Div('clinic_visit', css_class="col-md-4"),
                    css_class="row")),
            FormActions(Submit('submit',
                               'Enroll Participant',
                               ng_disabled='participantNewForm.$invalid',
                               style='margin-bottom:20px'),
                        css_class="row"))

        # thank you: http://stackoverflow.com/questions/24663564/django-add-attribute-to-every-field-by-default
        for field in self:

            field.field.widget.attrs.update({
                'ng-model':
                'participant.{0}'.format(field.name),
            })
示例#5
0
文件: forms.py 项目: nyafreddy/mwachx
    def __init__(self, *args, **kwargs):
        super(ContactAdd, self).__init__(*args, **kwargs)

        #Moved this here so that current date can be calculated for each new form

        birth_BO = [{
                'from': (today() - datetime.timedelta(days=14*365)).strftime("%Y-%m-%d"),
                'to': (datetime.datetime(2100,1,1)).strftime("%Y-%m-%d"),
            }]
        due_date_BO = [{
                'from': (datetime.datetime(1970,1,1)).strftime("%Y-%m-%d"),
                'to': (today() + datetime.timedelta(weeks=4)).strftime("%Y-%m-%d"), # between 4 ....
            }, {
                'from': (today() + datetime.timedelta(weeks=36)).strftime("%Y-%m-%d"), # ...and 36 weeks in the future
                'to': (datetime.datetime(2100,1,1)).strftime("%Y-%m-%d"),
            }]
        art_BO = [{
            'from': today().strftime("%Y-%m-%d"),
            'to': (datetime.datetime(2100,1,1)).strftime("%Y-%m-%d"),
        }]
        self.fields['due_date'].widget = util.AngularPopupDatePicker({'required':True},min=28)
        self.fields['birthdate'].widget = util.AngularPopupDatePicker(
            {'required':True,'datepicker-position-right':True},max=-5110 # 14 years or older 
        )
        self.fields['art_initiation'].widget = util.AngularPopupDatePicker(max=0)
        self.fields['clinic_visit'].widget = util.AngularPopupDatePicker({'required':True}, min=7)

        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_id = 'participant-details-form'
        self.helper.label_class = 'col-sm-6'
        self.helper.field_class = 'col-sm-6'
        self.helper.form_tag = False

        self.helper.layout = Layout(
            Fieldset(
                'Study Information',
                Div(
                    Div('study_id', css_class="col-md-4"),
                    Div('anc_num', css_class="col-md-4"),
                    Div('study_group', css_class="col-md-4"),
                    css_class="row"
                ),
                Div(
                    Div('ccc_num', css_class="col-md-4"),
                    Div('send_day', css_class="col-md-4", ng_if="participant.study_group != 'control'" ),
                    Div('send_time', css_class="col-md-4", ng_if="participant.study_group != 'control'" ),
                    css_class="row",
                ),
            ),

            Fieldset (
                'Client Information',
                Div(
                    Div('nickname', css_class="col-md-4"),
                    Div('phone_number', css_class="col-md-4"),
                    Div('birthdate', css_class="col-md-4"),
                    css_class="row"
                ),
                Div(
                    Div('relationship_status', css_class="col-md-4"),
                    Div('partner_name', css_class="col-md-4"),
                    Div('previous_pregnancies', css_class="col-md-4"),
                    css_class="row"
                ),
                Div(
                    Div('phone_shared', css_class="col-md-4"),
                    Div('language', css_class="col-md-4"),
                    Div('hiv_disclosed', css_class="col-md-4"),
                    css_class="row"
                ),
            ),

            Fieldset (
                'Medical Information',
                Div(
                    Div('condition', css_class="col-md-4"),
                    Div('art_initiation', css_class="col-md-4"),
                    Div('hiv_messaging', css_class="col-md-4"),
                    css_class="row"
                ),
                Div(
                    Div('due_date', css_class="col-md-4"),
                    Div('clinic_visit', css_class="col-md-4"),
                    css_class="row"
                )
            ),
            FormActions(
                Submit('submit', 'Enroll Participant',ng_disabled='participantNewForm.$invalid', style='margin-bottom:20px'),
                css_class="row"
            )
        )


        # thank you: http://stackoverflow.com/questions/24663564/django-add-attribute-to-every-field-by-default
        for field in self:

          field.field.widget.attrs.update({
              'ng-model': 'participant.{0}'.format(field.name),
          })