Example #1
0
    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user', None)
        super(JoinTeamForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = 'join_team'

        self.helper.layout = Layout(
            Fieldset(
                'Join team',
                HTML(
                    """<span style='color: grey;'>If you want to join a team that already exists,
                    ask somebody already on the team for the team code.  It will be on their account page.</span>
                    <br/><br/>"""),
                FieldWithButtons(Field('code', placeholder='Team code'),
                                 StrictButton('Join team', css_class='btn-success', type='submit'))
            )
        )
Example #2
0
 def __init__(self, *args, **kwargs):
     self.request = kwargs.pop("request", None)
     self.vega_extra_kwargs = kwargs.pop("vega_extra_kwargs", dict())
     super().__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_tag = True
     self.helper.render_required_fields = True
     self.helper.form_show_labels = True
     self.helper.html5_required = True
     self.helper.include_media = False
     self.helper.form_id = "artist-update"
     self.helper.layout = Layout(
         Field("name"),
         FormActions(
             Submit("submitBtn",
                    "Submit",
                    css_class="btn-success btn-block")),
     )
Example #3
0
    def __init__(self, *args, **kwargs):
        """Initiate the class."""

        super(CreateRatingAssessment, self).__init__(*args, **kwargs)

        self.fields['issuer'].choices = [
            (l.id, l.legal_name)
            for l in Issuer.objects.list_eligible_for_assessment()
        ]

        self.helper = FormHelper(form=self)
        self.helper.layout = Layout()

        self.helper.layout.append(
            Div(
                Div(Field('issuer'), css_class='col-md-12'),
                css_class='row',
            ), )
Example #4
0
    def __init__(self, issuer_pk=None, *args, **kwargs):
        """Initiate the class."""

        super(StartRatingProcess, self).__init__(*args, **kwargs)

        issuer_obj = Issuer.objects.get(pk=issuer_pk)

        existing_rating = current_rating(issuer_obj)

        self.helper = FormHelper(form=self)
        self.helper.layout = Layout()

        # For existing ratings, prohibit choosing "initial rating"
        if existing_rating:
            self.fields["event_type"].queryset = EventType.objects.\
                distinct().filter(id__in=[2, 3])
        else:
            self.fields["event_type"].queryset = EventType.objects.\
                distinct().filter(id__in=[1])

        # Event type is always required
        self.helper.layout.append(
            Div(
                Div(Field('event_type'), css_class='col-md-12'),
                css_class='row',
            ))

        # For existing ratings, we dont have many options
        if existing_rating:

            self.helper.layout.append(
                Field('is_preliminary', type='hidden', value=False))
            self.helper.layout.append(
                Field('rating_type',
                      type='hidden',
                      value=existing_rating.rating_type.id))
        else:

            # For new ratings, we have some options
            self.helper.layout.append(
                Div(
                    Div(Field('rating_type'), css_class='col-md-12'),
                    css_class='row',
                ), )
            self.helper.layout.append(
                Div(
                    Div(Field('is_preliminary'), css_class='col-md-12'),
                    css_class='row',
                ), )

        self.helper.layout.append(
            Field('issuer', type='hidden', value=issuer_pk))
Example #5
0
 def __init__(self, *args, **kwargs):
     print("passwordForm")
     super(PasswordResetForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper(self)
     self.helper.form_id = "id-personal"
     self.helper.form_method = "POST"
     self.helper.form_action = ''
     #self.helper.add_input(Submit('submit','Submit',data_style="expand-right",css_class="ladda-button pull-right btn-primary"))
     self.helper.form_class = 'form-horizontal container'
     self.helper.label_class = "col-sm-3 text-right"
     self.helper.field_class = "col-sm-9"
     self.helper.layout = Layout(
         Field('email', rows="6", css_class='input-xlarge'),
         Div(
             Submit('submit',
                    'Submit',
                    data_style="expand-right",
                    css_class="ladda-button pull-right btn-primary")))
Example #6
0
    def __init__(self, *args, **kwargs):
        super(SearchForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'search-data-form'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'

        self.helper.form_method = 'get'
        self.helper.form_action = reverse('search')
        self.helper.add_input(
            Submit('submit', 'Submit', css_class='btn-success'))
        self.helper.form_class = 'form-horizontal'
        self.helper.layout = Layout(
            Fieldset(
                'Search',
                Field('search',
                      placeholder='Search for a gene or a variant or region',
                      title=False)))
Example #7
0
    def __init__(self,
                 allow_edit=True,
                 res_short_id=None,
                 element_id=None,
                 element_name=None,
                 *args,
                 **kwargs):
        """Render Abstract form.

        The order in which the model fields are listed for the FieldSet is the order these
        fields will be displayed
        """
        field_width = 'form-control input-sm'
        layout = Layout(Field('abstract', css_class=field_width), )

        super(AbstractFormHelper,
              self).__init__(allow_edit, res_short_id, element_id,
                             element_name, layout, *args, **kwargs)
Example #8
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')))
Example #9
0
    def __init__(self, allow_edit=True, res_short_id=None, element_id=None, element_name=None,
                 *args, **kwargs):
        """Render layout for CoverageSpatial form."""
        file_type = kwargs.pop('file_type', False)

        layout = Layout()
        # the order in which the model fields are listed for the FieldSet is the order these
        # fields will be displayed
        layout.append(Field('type', id="id_{}_filetype".format('type') if file_type else
                            "id_{}".format('type')))
        form_field_names = ['name', 'projection', 'east', 'north', 'northlimit', 'eastlimit',
                            'southlimit', 'westlimit', 'units']
        crispy_form_fields = get_crispy_form_fields(form_field_names, file_type=file_type)
        for field in crispy_form_fields:
            layout.append(field)
        kwargs['coverage'] = 'spatial'
        super(CoverageSpatialFormHelper, self).__init__(allow_edit, res_short_id, element_id,
                                                        element_name, layout,  *args, **kwargs)
Example #10
0
 def __init__(self, *args, **kwargs):
     super(CustomerBirthdayGreetingsForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'id-customer-birthday-greetings-form'
     self.helper.form_method = 'post'
     self.helper.layout = Layout(
         Field('birthday_greeting_active'),
         Field('birthday_greeting_sender'),
         Field('birthday_greeting_subject'),
         Field('birthday_greeting_email'),
         Field('birthday_greeting_sms'),
         Field('birthday_greeting_send_email'),
         Field('birthday_greeting_send_sms'),
         FormActions(
             Submit('submit', _('Save'), css_class='btn-success')
         )
     )
Example #11
0
 def __init__(self, *args, **kwargs):
     super(CustomerScriptForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'id-customer-script-form'
     self.helper.form_method = 'post'
     self.helper.layout = Layout(
         Field('custom_reminder'),
         Field('reminder_sender'),
         Field('reminder_subject'),
         Field('reminder_email'),
         Field('reminder_sms'),
         Field('show_confirm_link'),
         Field('show_cancel_link'),
         FormActions(
             Submit('submit', _('Save'), css_class='btn-success')
         )
     )
Example #12
0
    def __init__(self, *args, **kwargs):
        super(DriverForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.form_class = 'form-horizontal'

        self.helper.layout = Layout(
            Div(Div(Field('last', autofocus=True), css_class="col-md-3"),
                Div(Field('first'), css_class="col-md-3"),
                Div(Field('country'), css_class="col-md-3"),
                Div(PrependedText('twitter', "@"), css_class="col-md-3"),
                css_class="row"),
            Div(Div(Field('rookie'), css_class="col-md-3"),
                Div(Field('number'), css_class="col-md-3"),
                Div(Field('dob', placeholder="YYYY-MM-DD"),
                    css_class="col-md-3"),
                Div(Field('died', placeholder="YYYY-MM-DD"),
                    css_class="col-md-3"),
                css_class="row"),
            Div(Div(Field('active'), css_class="col-md-3"), css_class="row"),
            Submit('submit', u'Submit', css_class='btn btn-success'),
        )
Example #13
0
def get_crispy_form_fields(field_names, file_type=False):
    """Return a list of objects of type Field.

    :param field_names: list of form field names
    :param file_type: if true, then this is a metadata form for file type, otherwise, a form
    for resource
    :return: a list of Field objects
    """
    crispy_fields = []

    def get_field_id(field_name):
        if file_type:
            return "id_{}_filetype".format(field_name)
        return "id_{}".format(field_name)

    for field_name in field_names:
        crispy_fields.append(Field(field_name, css_class='form-control input-sm',
                                   id=get_field_id(field_name)))
    return crispy_fields
Example #14
0
 def __init__(self, *args, **kwargs):
     super(CreatorFormSetHelper, self).__init__(*args, **kwargs)
     # the order in which the model fields are listed for the FieldSet is the order
     # these fields will be displayed
     field_width = 'form-control input-sm'
     self.form_tag = False
     self.form_show_errors = True
     self.error_text_inline = True
     self.html5_required = True
     self.layout = Layout(
         Fieldset(
             'Creator',
             Field('name', css_class=field_width),
             Field('description', css_class=field_width),
             Field('organization', css_class=field_width),
             Field('email', css_class=field_width),
             Field('address', css_class=field_width),
             Field('phone', css_class=field_width),
             Field('homepage', css_class=field_width),
             Field('order', css_class=field_width),
         ), )
Example #15
0
    def __init__(self, *args, **kwargs):
        # magic
        print("UserProfileForm")
        print(kwargs['instance'])
        self.user = kwargs['instance'].user
        user_kwargs = kwargs.copy()
        user_kwargs['instance'] = self.user
        self.uf = UserForm(*args, **user_kwargs)
        # magic end

        super(UserProfileForm, self).__init__(*args, **kwargs)

        self.fields.update(self.uf.fields)
        self.initial.update(self.uf.initial)

        self.helper = FormHelper(self)
        self.helper.form_id = "id-personal"
        self.helper.form_method = "POST"
        try:
            Subscription.objects.get(user=self.user)
            self.fields['subscribe'].initial = True
        except Subscription.DoesNotExist:
            pass
        self.helper.form_action = '.'
        self.helper.form_class = 'form-horizontal container form-file'
        self.helper.label_class = "col-sm-3 text-sm-right"
        self.helper.field_class = "col-sm-9 "
        self.helper.layout = Layout(
            Field('first_name', rows="6", css_class='input-xlarge'),
            Field('last_name', rows="6", css_class='input-xlarge'),
            Field('avatar',
                  template="user/profile/avatar.html",
                  rows="6",
                  css_class='input-xlarge'),
            Field('resume',
                  template="user/profile/resume.html",
                  rows="6",
                  css_class='input-xlarge'),
            Field('checkbox', template="empty.html"),
            Field('resume_checkbox', template="empty.html"),
            Field('subscribe'),
            Submit('submit',
                   'Submit',
                   data_style="expand-right",
                   css_class="ladda-button pull-right btn-primary"))
Example #16
0
    def __init__(self, *args, **kwargs):
        # magic
        print("UserProfileForm")
        print(kwargs['instance'])
        self.user = kwargs['instance'].user
        user_kwargs = kwargs.copy()
        user_kwargs['instance'] = self.user
        self.uf = UserForm(*args, **user_kwargs)
        # magic end

        super(UserStaffProfileForm, self).__init__(*args, **kwargs)

        self.fields.update(self.uf.fields)
        self.initial.update(self.uf.initial)

        self.helper = FormHelper(self)
        self.helper.form_id = "id-personal"
        self.helper.form_method = "POST"

        self.helper.form_action = '.'
        self.helper.form_class = 'form-horizontal container form-file'
        self.helper.label_class = "col-sm-3 text-sm-right"
        self.helper.field_class = "col-sm-9 "
        self.helper.layout = Layout(
            Field('first_name', rows="6", css_class='input-xlarge'),
            Field('last_name', rows="6", css_class='input-xlarge'),
            Field('preferences',
                  data_tags="true",
                  data_token_separators="[',']",
                  data_minimum_input_length="0",
                  data_delay="300",
                  multiple="multiple",
                  ajax__cache="true"),
            HTML(
                '<div class="form-group"><div class="control-label col-sm-3"></div><span class="form-text offset-sm-3" style="color:black; font-size:13px;padding-left:10px;" display:inline><span class="badge badge-grey">Grey</span> Approved keywords.<br/> <span class="badge badge-success">Green</span> Users-created keywords.<br/><span class="badge badge-primary">Blue</span> Keywords not created yet</span>'
            ),
            Field('avatar',
                  template="user/profile/avatar.html",
                  rows="6",
                  css_class='input-xlarge'),
            Field('resume',
                  template="user/profile/resume.html",
                  rows="6",
                  css_class='input-xlarge'),
            Field('checkbox', template="empty.html"),
            Submit('submit',
                   'Submit',
                   data_style="expand-right",
                   css_class="ladda-button pull-right btn-primary"))
Example #17
0
    def __init__(self, *args, **kwargs):
        super(SessionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.form_class = 'form-horizontal'
        self.helper.form_tag = False

        # self.fields['starttime'].widget = DateTimePicker(options={"format": "YYYY-MM-DD HH:mm"})
        # self.fields['endtime'].widget   = DateTimePicker(options={"format": "YYYY-MM-DD HH:mm"})
        # self.fields['posttime'].widget  = DateTimePicker(options={"format": "YYYY-MM-DD HH:mm"})

        self.helper.layout = Layout(
            Div(
                Div(
                    Div(Field('type', autofocus=True), css_class="col-md-3"),
                    Div(Field('name'), css_class="col-md-3"),
                    Div(Field('posttime', placeholder="YYYY-MM-DD HH:MM"),
                        css_class="col-md-3"),
                    Div(Field('channel'), css_class="col-md-2"),
                    # Div(PrependedText('post', ''), css_class="col-md-1"),
                    Div(HTML(
                        """<div class="form-group"><label class="control-label">&nbsp;</label><div class="controls"><a class="btn btn-danger" href="javascript:void(0)"><strong>X</strong></a></div></div>"""
                    ),
                        align="right",
                        css_class="col-md-1"),
                    css_class="row"),
                Div(
                    Div(Field('starttime', placeholder="YYYY-MM-DD HH:MM"),
                        css_class="col-md-3"),
                    Div(Field('endtime', placeholder="YYYY-MM-DD HH:MM"),
                        css_class="col-md-3"),
                    Div(Field('tvstarttime', placeholder="YYYY-MM-DD HH:MM"),
                        css_class="col-md-3"),
                    Div(Field('tvendtime', placeholder="YYYY-MM-DD HH:MM"),
                        css_class="col-md-3"),
                    # Div(Field('starttime'), css_class="col-md-4"),
                    # Div(Field('endtime'), css_class="col-md-4"),
                    # Div(Field('posttime'), css_class="col-md-4"),
                    css_class="row"),
                css_class="well well-lg session-form"))
Example #18
0
    def __init__(self, issuer_pk=None, *args, **kwargs):
        """Initiate the class."""

        super(AddIssueForm, self).__init__(*args, **kwargs)

        # These fields are not required in the model but should be
        # Add as per below instead of making required to avoid fixing
        # null values in the database.
        for field in ISSUE_REQUIRED_FIELDS:
            self.fields[field].required = ISSUE_REQUIRED_FIELDS[field]

        # Provide some help text for the user
        for field in ISSUE_HELP_FIELDS:
            self.fields[field].help_text = ISSUE_HELP_FIELDS[field]

        self.helper = FormHelper(form=self)
        self.helper.layout = Layout(CommonIssueLayout(), )

        self.helper.layout.append(
            Field('issuer', type='hidden', value=issuer_pk))
Example #19
0
 def __init__(self, *args, **kwargs):
     self.request = kwargs.pop('request', None)
     super().__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_tag = True
     self.helper.form_method = 'GET'
     self.helper.render_required_fields = True
     self.helper.form_show_labels = False
     self.helper.html5_required = True
     self.helper.form_id = 'vega-search-form'
     self.helper.form_class = 'form-inline'
     self.helper.field_template = \
         f'{settings.VEGA_CRISPY_TEMPLATE_PACK}/layout/inline_field.html'
     self.helper.layout = Layout(
         FieldWithButtons(
             Field('q', css_class="input-sm"),
             Submit('submitBtn',
                    _(settings.VEGA_LISTVIEW_SEARCH_TXT),
                    css_class='btn-sm'),
         ))
Example #20
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    'Basic Information',
                    Field('project_code', css_class="col-md-3"),
                    Field('name', wrapper_class="col-md-9"),
                    Field('client', wrapper_class="col-md-3"),
                    Field('description', wrapper_class="col-md-9"),
                    Field('start_date', wrapper_class="col-md-6"),
                    Field('expected_end_date', wrapper_class="col-md-6"),
                ), Tab(('Settings'), )))
Example #21
0
 def __init__(self, *args, **kwargs):
     super(VariableFormHelper, self).__init__(*args, **kwargs)
     field_width = 'form-control input-sm'
     self.form_tag = False
     self.form_show_errors = True
     self.error_text_inline = True
     self.html5_required = True
     # change the fields name here
     self.layout = Layout(
         Fieldset('Variable',
                  Field('name', css_class=field_width),
                  Field('unit', css_class=field_width),
                  Field('type', css_class=field_width),
                  Field('shape', css_class=field_width),
                  Field('descriptive_name', css_class=field_width),
                  Field('method', css_class=field_width),
                  Field('missing_value', css_class=field_width)
                  ),
         )
Example #22
0
    def __init__(self, allow_edit=True, res_short_id=None, element_id=None, element_name=None,
                 show_variable_code_selection=False, *args, **kwargs):
        field_width = 'form-control input-sm'
        common_layout = Layout(
                     Field('selected_series_id', css_class=field_width, type="hidden"),
                     Field('available_variables', css_class=field_width, type="hidden"),
                     Field('variable_code', css_class=field_width,
                           title="A brief and unique code that identifies the measured "
                                 "variable (e.g., 'Temp')."),
                     Field('variable_name', css_class=field_width,
                           title="A brief but descriptive name of the variable that was measured "
                                 "selected from a controlled vocabulary of variable names "
                                 "(e.g., 'Temperature').\n"
                                 "Select 'Other...' to specify a new variable name term."),
                     Field('variable_type', css_class=field_width,
                           title="A term selected from a controlled vocabulary that describes the "
                                 "type of variable that was measured (e.g., 'Water quality').\n"
                                 "Select 'Other...' to specify a new variable type term."),
                     Field('no_data_value', css_class=field_width,
                           title="A numeric value that is used to represent 'NoData' values "
                                 "in the time series (e.g., -9999)."),
                     Field('variable_definition', css_class=field_width,
                           title="An optional, longer text description of the variable "
                                 "(e.g., 'Water temperature')."),
                     Field('speciation', css_class=field_width,
                           title="A term describing the chemical speciation of the resulting data "
                                 "values. For most continuous time series from environmental "
                                 "sensors, this will be 'Not Applicable'.\n"
                                 "Select 'Other...' to specify a new speciation term."),
                )

        layout = _set_form_helper_layout(
            common_layout=common_layout, element_name="variable",
            is_show_element_code_selection=show_variable_code_selection,
            field_css=field_width)

        super(VariableFormHelper, self).__init__(allow_edit, res_short_id, element_id,
                                                 element_name, layout,  *args, **kwargs)
Example #23
0
    def __init__(self, *args, **kwargs):
        super(AgendaAdministrativaForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'
        self.helper.add_input(Submit('submit', 'gravar'))
        self.helper.add_input(
            Submit(
                'cancel',
                'Cancelar',
                css_class='btn-danger',
                formnovalidate='formnovalidate',
            ))

        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    'Pauta', InlineRadios('compartilhada'),
                    Field(PrependedText(
                        'dt_referencia',
                        '<i class="glyphicon glyphicon-calendar"></i>'),
                          css_class='datepicker'), 'pauta'),
                Tab(
                    'Outras Informações', 'tipo_agenda', 'pessoas_envolvidas',
                    PrependedText(
                        'inicio_acao',
                        '<i class="glyphicon glyphicon-calendar"></i>'),
                    'esfera', 'orgao_demandante', 'coordenador_agenda',
                    InlineRadios('prioridade'), 'dpto_setor',
                    PrependedText(
                        'fim_acao',
                        '<i class="glyphicon glyphicon-calendar"></i>'),
                    PrependedText(
                        'dt_prev_dis_agenda',
                        '<i class="glyphicon glyphicon-calendar"></i>'),
                    PrependedText(
                        'dt_prev_fim_agenda',
                        '<i class="glyphicon glyphicon-calendar"></i>'))))
Example #24
0
def edit_client_helper():
    helper = FormHelper()
    helper.form_id = 'id-edit-full-client-form'
    helper.form_method = 'post'
    helper.layout = Layout(
        Fieldset(
            getattr(labels, 'EDIT_CLIENT', _('Edit client')),
            'email',
            'phone',
            'first_name',
            'last_name',
            Field('birth_date', id="id_birth_date"),
            'client_id',
        ),
        FormActions(
            Submit('submit', _('Save'), css_class='btn-success'),
            HTML("<a class='btn btn-default' href='{% url \"users:list\" %}'>Cancel</a>"),
            css_class="form-group"
        )
    )

    return helper
Example #25
0
    def __init__(self, *args, **kwargs):
        super(BridgeCreateForm, self).__init__(*args, **kwargs)
        helper = self.helper = FormHelper()

        layout = helper.layout = Layout()
        layout.append(Field('events', css_class='board-event'))
        layout.append(
            FormActions(
                HTML(
                    '<button class="btn btn-info" type="button" onclick="document.querySelectorAll(\'.board-event\').forEach(x => x.checked = true);">Check all</button>'
                )))
        layout.append(
            FormActions(
                HTML(
                    '<button class="btn btn-info" type="button" onclick="document.querySelectorAll(\'.board-event\').forEach(x => x.checked = false);">Uncheck all</button>'
                )))
        layout.append(FormActions(Submit('save', 'Save')))

        helper.form_show_labels = False
        helper.form_class = 'form-horizontal'
        helper.field_class = 'col-lg-8'
        helper.help_text_inline = True
Example #26
0
    def __init__(self, *args, **kwargs):
        """Render layout for Contributor model form and activate required fields."""
        super(ContributorFormSetHelper, self).__init__(*args, **kwargs)
        # the order in which the model fields are listed for the FieldSet is the order
        # these fields will be displayed
        field_width = 'form-control input-sm'
        self.form_tag = False
        self.layout = Layout(
            Fieldset('Contributor',
                     Field('name', css_class=field_width),
                     Field('description', css_class=field_width),
                     Field('organization', css_class=field_width),
                     Field('email', css_class=field_width),
                     Field('address', css_class=field_width),
                     Field('phone', css_class=field_width),
                     Field('homepage', css_class=field_width),
                     ),
        )

        self.render_required_fields = True,
Example #27
0
 def __init__(self, *args, **kwargs):
     super(Auditorlistform, self).__init__(*args, **kwargs)
     lis = []
     for i in ListAuditors.objects.all():
         try:
             lis.append(i.auditors.id)
         except:
             pass
     self.fields['auditors'].queryset = EmployeeDetails.objects.filter(
         emp_status=0).exclude(id__in=lis)
     self.fields[
         'auditors'].label_from_instance = lambda obj: "%s" % obj.emp_name
     self.helper = FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.label_class = 'col-lg-2'
     self.helper.layout = Layout(
         Field('auditors'),
         ButtonHolder(
             Submit('submit', 'Submit', css_class='btn-success'),
             HTML(
                 """<a class= "btn btn-success" href= "{% url 'QMS:auditorlistview' %}"> Back</a>"""
             )))
Example #28
0
    def __init__(self, allow_edit=True, res_short_id=None, element_id=None, element_name=None,
                 show_method_code_selection=False, *args, **kwargs):
        # the order in which the model fields are listed for the FieldSet is the order these
        # fields will be displayed
        file_type = kwargs.pop('file_type', False)
        field_width = 'form-control input-sm'
        common_layout = Layout(
                         Field('selected_series_id', css_class=field_width, type="hidden"),
                         Field('available_methods', css_class=field_width, type="hidden"),
                         Field('method_code', css_class=field_width,
                               id=_get_field_id('method_code', file_type=file_type),
                               title="A brief and unique code that identifies the method used to "
                                     "create the observations (e.g., 'Hydrolab')."),
                         Field('method_name', css_class=field_width,
                               id=_get_field_id('method_name', file_type=file_type),
                               title="A brief but descriptive name for the method used to create "
                                     "the observations (e.g., 'Hydrolab MiniSonde 5')."),
                         Field('method_type', css_class=field_width,
                               id=_get_field_id('method_type', file_type=file_type),
                               title="A term selected from a controlled vocabulary to describe the "
                                     "type of method used to create the observations. For "
                                     "sensor measurements use 'Instrument deployment'.\n"
                                     "Select 'Other...' to specify a new method type term."),
                         Field('method_description', css_class=field_width,
                               id=_get_field_id('method_description', file_type=file_type),
                               title="A longer text description of the method "
                                     "(e.g., 'Water temperature measured using a "
                                     "Hydrolab Multiparameter Sonde')."),
                         Field('method_link', css_class=field_width,
                               id=_get_field_id('method_link', file_type=file_type),
                               title="A URL link to a website that contains more information "
                                     "about or a detailed description of the method "
                                     "(e.g., 'http://www.hydrolab.com')."),
                         )

        layout = _set_form_helper_layout(common_layout=common_layout, element_name="method",
                                         is_show_element_code_selection=show_method_code_selection,
                                         field_css=field_width)

        super(MethodFormHelper, self).__init__(allow_edit, res_short_id, element_id, element_name,
                                               layout,  *args, **kwargs)
Example #29
0
    def __init__(self, *args, **kwargs):
        super(VacancyForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'

        self.helper.form_class = 'pt-5'
        self.helper.use_custom_control = True
        self.helper.layout = Layout(
            Row(
                Div(
                    Field('title'),
                    css_class='col-12 col-md-6',
                ),
                Div(
                    Field('specialty'),
                    css_class='col-12 col-md-6',
                ),
                Div(
                    Field('salary_min'),
                    css_class='col-12 col-md-6',
                ),
                Div(
                    Field('salary_max'),
                    css_class='col-12 col-md-6',
                ),
                Div(
                    Field('skills'),
                    css_class='col-12',
                ),
                Div(
                    Field('description'),
                    css_class='col-12',
                ),
            ),
            Row(
                Div(
                    FormActions(Submit('submit', 'Сохранить', css_class='btn btn-info')),
                    css_class='col-6',
                ),
                Div(
                    Button('delete', 'Удалить', css_class='d-none', css_id='id_btn_delete'),
                    css_class='col-6',
                ),
            ),
        )
Example #30
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    'Basic Information',
                    Field('company_name', css_class="col-md-12"),
                    Field('adress', wrapper_class="col-md-12"),
                    Field('email', wrapper_class="col-md-6"),
                    Field('contact', wrapper_class="col-md-6"),
                    Field('website', wrapper_class="col-md-6"),
                    Field('contact_person', wrapper_class="col-md-6"),
                    Field('profile_pic', wrapper_class="col-md-12"),
                ),
                Tab(
                    ('Settings'),
                )
            )
        )