Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        super(BrandForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False

        self.helper.layout = Layout(
            'collector_name',
            'respondent_name',
            'respondent_city',
            'favourite_drink',
            MultiWidgetField('date_of_collection',
                             attrs=({
                                 'style':
                                 'width: 32.7%; display: inline-block;'
                             })),
        )
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        super(Out_patientForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', 'Save'))

        self.helper.layout = Layout(
            'patient',
            MultiWidgetField('date',
                             attrs=({
                                 'style':
                                 'width: 32.8%; display: inline-block;'
                             })),
            'doctor',
            'diagnosis',
        )
Exemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        super(BlogPostModelForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        # self.helper.form_class = 'form-horizontal'
        # self.helper.form_method = 'post'
        # self.helper.add_input(Submit('submit', 'Save'))

        self.helper.layout = Layout(
            'title',
            'image',
            'slug',
            'content',
            MultiWidgetField('publish_date',
                             attrs=({
                                 'style':
                                 'width: 32.8%; display: inline-block;'
                             })),
        )
Exemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        super(PatientForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', 'Save'))

        self.helper.layout = Layout(
            'first_name', 'last_name', 'gender',
            MultiWidgetField('dob',
                             attrs=({
                                 'style':
                                 'width: 32.8%; display: inline-block;'
                             })), 'age',
            Fieldset(
                'Contact Information',
                Field('country', 'city', 'address', 'contact_no',
                      'next_of_kin')))
Exemplo n.º 5
0
    def __init__(self, *args, **kwargs):

        super(UserProfileForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                '',
                Div(
                    Div(
                        'name',
                        css_class='col-md-6',
                    ),
                    Div(css_class='col-md-1', ),
                    Div(
                        'gender',
                        css_class='col-md-5',
                    ),
                    css_class='row',
                ),
                MultiWidgetField('birthday',
                                 attrs=({
                                     'style':
                                     'width: 32.7%; display: inline-block;'
                                 })),
            ),
            Fieldset(
                '',
                'username',
                'personal_slogan',
                'self_introduction',
            ),
            Fieldset(
                '',
                'place_of_origin',
                'current_residence',
                'education',
                'occupation',
                'skype_id',
            ),
            ButtonHolder(
                Submit('submit', _('Confirm'), css_class='btn btn-primary'), ),
        )
Exemplo n.º 6
0
def ProgressionFields(title, field, count):
    return Div(
        Div(
            HTML("<label clas='text-right'>%s</label>" % title),
            css_class='col-sm-2 progression-label',
        ),
        Div(
            MultiWidgetField(
                field,
                attrs=(
                    {
                        'class': "col-sm-2",
                        'style': "width: %s%%;" % (100. / count)
                    }
                )
            ),
            css_class='row col-sm-10'
        ),
        css_class='row progression-fields',
    )
Exemplo n.º 7
0
 def __init__(self, *args, **kwargs):
     self.create = kwargs.pop("create", False)
     super().__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_method = 'post'
     self.helper.add_input(
         Submit('submit',
                'Create' if self.create else 'Update',
                css_class='btn-primary'))
     self.helper.layout = Layout(
         Row(Column('content', css_class='form-group col-md-6 mb-0'),
             css_class='form-row'),
         Row(MultiWidgetField('deadline',
                              attrs=({
                                  'style':
                                  'width: 33%; display: inline-block;'
                              })),
             css_class='form-row'),
     )
     self.helper.label_class = 'd-block'
Exemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        super(DoctorForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        # self.helper.form_class = 'form-horizontal'
        # self.helper.form_method = 'post'
        # self.helper.add_input(Submit('submit', 'Save'))
        self.helper.form_tag = False

        self.helper.layout = Layout(
            'first_name',
            'last_name',
            'gender',
            MultiWidgetField('dob',
                             attrs=({
                                 'style':
                                 'width: 32.8%; display: inline-block;'
                             })),
            'age',
            'country',
            'city',
            'address',
        )
Exemplo n.º 9
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = FormHelperWithDefaults()
     if (self.defaults.get('sender')):
         del self.fields['sender_name']
         del self.fields['sender_email']
         del self.fields['no_bots']
         self.helper.add_input(Submit('submit', pgettext_lazy(context=self.defaults['sender'].get_gender(), message='Send')))
     else:
         self.fields['sender_name'].required = True
         self.fields['sender_email'].required = True
         self.helper.add_layout(
             MultiWidgetField(
                 Row(
                     Div('sender_name', css_class='col-md-6'),
                     Div('sender_email', css_class='col-md-6'),
                 ),
                 'text',
                 'no_bots',
             ),
         )
         self.helper.add_input(Submit('submit', _('Send')))
Exemplo n.º 10
0
    def __init__(self, *args, **kwargs):
        super(TreatmentForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        # self.fields['symptoms'].widget.attrs['style'] = 'resize:none' //setting textarea resize to none
        # self.helper.form_class = 'form-horizontal'
        # self.helper.form_method = 'post'
        # self.helper.add_input(Submit('submit', 'Save'))
        self.helper.form_tag = False

        self.helper.layout = Layout(
            'patient',
            'doctor',
            MultiWidgetField(
                'date',
                attrs=(
                    {'style': 'width: 32.8%; display: inline-block;'}
                )
            ),
            'symptoms',
            'diagnosis',
            'doctors_comments',
        )
Exemplo n.º 11
0
class JobSearchForm(forms.Form):
  # Be sure to check whether fields match respective ones located in models.py
  
  # Form fields
  name_field = forms.CharField(
    label=False,
    required=False,
    max_length=200)
  deadline_date_field = forms.DateField(
    label=False,
    required=False,
    widget=forms.SelectDateWidget)
  location_field = forms.CharField(
    label=False,
    required=False,
    max_length=200)
  salary_field = forms.IntegerField(
    label=False,
    required=False)
  duration_field = forms.IntegerField(
    label=False,
    required=False)
  date_posted_field = forms.DateField(
    label=False,
    required=False,
    widget=forms.SelectDateWidget)
  tag_field = forms.ModelChoiceField(
    label=False,
    required=False,
    queryset=Tag.objects.all().order_by('name'))
  # Setting the layout of the form 
  helper = FormHelper()
  helper.form_method = 'GET'
  helper.form_id = 'search-form'
  helper.form_action = 'search/'
  helper.add_input(Submit('search', 'Search'))
  helper.layout = Layout(
    Field('name_field', placeholder='What do you want to do?'),
    Accordion(
      AccordionGroup('Deadline',
        MultiWidgetField(
          'deadline_date_field', 
          attrs=(
            {'style': 'width: 33%; display: inline-block;'})
        )
      ),
      AccordionGroup('Location',
        Field('location_field', placeholder='Type in location where you would like to work')
      ),
      AccordionGroup('Salary',
        Field('salary_field', placeholder='Type in minimal salary')
      ),
      AccordionGroup('Duration',
        Field('duration_field', placeholder='Type in minimal duration of the job (in weeks)')
      ),
      AccordionGroup('Date posted', 
        MultiWidgetField(
          'date_posted_field', 
          attrs=(
            {'style': 'width: 33%; display: inline-block;'})
        )
      ),
      AccordionGroup('Tag', 
        'tag_field'
      )
    )
  )
Exemplo n.º 12
0
    def __init__(self, *args, **kwargs):
        """Selects custom layout and placeholders for the form."""
        super().__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        helper = self.helper
        helper.form_action = 'users:shipping-billing'
        helper.form_id = 'shipping_billing_form'
        helper.form_tag = False

        self.fields['shipping_phone_number'] = forms.CharField(
            widget=widgets.PhoneNumberPrefixWidget(), required=False)

        self.fields['billing_phone_number'] = forms.CharField(
            widget=widgets.PhoneNumberPrefixWidget(), required=False)

        self.fields['shipping_full_name'].label = _('Full Name')
        self.fields['shipping_street_address_1'].label = _('Street Address 1')
        self.fields['shipping_street_address_2'].label = _('Street Address 2')
        self.fields['shipping_town_or_city'].label = _('Town or City')
        self.fields['shipping_county'].label = _('County, State or Locality')
        self.fields['shipping_country'].label = _('Country')

        self.fields['billing_full_name'].label = _('Full Name')
        self.fields['billing_street_address_1'].label = _('Street Address 1')
        self.fields['billing_street_address_2'].label = _('Street Address 2')
        self.fields['billing_town_or_city'].label = _('Town or City')
        self.fields['billing_county'].label = _('County, State or Locality')
        self.fields['billing_postcode'].label = _('Postcode')
        self.fields['billing_country'].label = _('Country')

        helper.layout = Layout(
            Row(
                Column(
                    Fieldset(
                        _('SHIPPING DETAILS'),
                        Row(
                            Field('shipping_full_name',
                                  placeholder=_('Full Name'),
                                  css_class='p-font text-primary'),
                            MultiWidgetField(
                                'shipping_phone_number',
                                template='bootstrap4/phone_field.html'),
                            Field('shipping_street_address_1',
                                  placeholder=_('Street Address 1'),
                                  css_class='p-font text-primary'),
                            Field('shipping_street_address_2',
                                  placeholder=_('Street Address 2'),
                                  css_class='p-font text-primary'),
                            Field('shipping_town_or_city',
                                  placeholder=_('Town or City'),
                                  css_class='p-font text-primary'),
                            Field('shipping_county',
                                  placeholder=_('County, State or Locality'),
                                  css_class='p-font text-primary'),
                            Field('shipping_postcode',
                                  placeholder=_('Postcode'),
                                  css_class='p-font text-primary'),
                            Field(
                                'shipping_country',
                                css_class='form-select p-font text-primary'))),
                    css_class='col-12 col-md-6 p-2 px-md-4 pt-md-4 pb-md-2'),
                Column(
                    Fieldset(
                        _('BILLING DETAILS'),
                        Row(
                            Field('billing_full_name',
                                  placeholder=_('Full Name'),
                                  css_class='p-font text-primary'),
                            MultiWidgetField(
                                'billing_phone_number',
                                template='bootstrap4/phone_field.html'),
                            Field('billing_street_address_1',
                                  placeholder=_('Street Address 1'),
                                  css_class='p-font text-primary'),
                            Field('billing_street_address_2',
                                  placeholder=_('Street Address 2'),
                                  css_class='p-font text-primary'),
                            Field('billing_town_or_city',
                                  placeholder=_('Town or City'),
                                  css_class='p-font text-primary'),
                            Field('billing_county',
                                  placeholder=_('County, State or Locality'),
                                  css_class='p-font text-primary'),
                            Field('billing_postcode',
                                  placeholder=_('Postcode'),
                                  css_class='p-font text-primary'),
                            Field(
                                'billing_country',
                                css_class='form-select p-font text-primary'))),
                    css_class='col-12 col-md-6 p-2 px-md-4 pt-md-4 pb-md-2'),
                Column(StrictButton(
                    _('Save Details'),
                    type='submit',
                    css_class='p-font btn-tran btn btn-sm fw-bold \
                                        btn-warning text-primary shadow'),
                       css_class='col-12 col-md-auto ps-2 pb-2 px-md-4 \
                           pb-md-4 mx-md-auto')))