Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        adminForm = False
        if kwargs.has_key("request") and kwargs["request"].user is not None:
            adminForm = kwargs["request"].user.is_staff
            del kwargs["request"]

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

        self.helper = FormHelper()
        instance = kwargs.get("instance", None)
        if instance is None:
            raise ValueError("Instance has to be set to use this form")

        tablist = []

        if not adminForm:
            del self.fields["package"]
            del self.fields["adminComment"]
            del self.fields["commitment"]
            del self.fields["rtTicketId"]
            del self.fields["clearedForBilling"]
            del self.fields["socialMediaAnnounced"]

        if adminForm:
            adminList = [
                Div(HTML(
                    "<strong>Connected with <a href=\"{% url 'sponsorcontact_update' pk=object.contact.pk %}\">{{object.contact.companyName}}</a></strong>"
                ),
                    css_class="form-group"),
                Field("package"),
                Field("commitment"),
                Field("clearedForBilling"),
                Field("rtTicketId"),
            ]
            if instance.package.hasSocialMedia:
                adminList.append(Field("socialMediaAnnounced"))

            adminList.extend([
                Field("adminComment"),
                Div(HTML(
                    "<p>The access link for the sponsor is <a href=\"" +
                    settings.SPONSOR_URL +
                    "{% url 'auth_token' token=object.owner.legacy_profile.authToken %}\">"
                    + settings.SPONSOR_URL +
                    "{% url 'auth_token' token=object.owner.legacy_profile.authToken %}</a></p>"
                ),
                    css_class="form-group"),
            ])

            tablist.append(Tab("Admin", *adminList))

        general_fields = [Field("displayCompanyName"), Field("logo")]
        if instance.logo:
            general_fields.append(
                Div(HTML(
                    "<p>Current logo:</p><img src=\"{{object.logo.url}}\" style=\"max-height:200px\"/>"
                ),
                    css_class="control-group"))

        if instance.package.hasLogoOnPrintmedia:
            general_fields.append(Field("vectorLogo"))

        textOptOutNotice = Div(HTML(
            "Please use the <span class=\"glyphicon glyphicon-ban-circle\"></span>-button in fields to indicate that you will not fill the respective field."
        ),
                               css_class="alert alert-info")

        general_fields.append(Field("homepage"))
        tablist.append(Tab("General", *general_fields))

        tablist.append(
            Tab(
                "Billing Address",
                textOptOutNotice,
                TextOptOut("billingReference"),
                Field("billingAddress"),
                Field("billingInForeignCountry"),
            ))
        if instance.package.hasSocialMedia:
            tablist.append(
                Tab(
                    "Social Media",
                    textOptOutNotice,
                    TextOptOut("twitterAccount"),
                    TextOptOut("facebookAccount"),
                    TextOptOut("facebookPage"),
                    TextOptOut("gplusAccount"),
                    TextOptOut("gplusPage"),
                ))
        if instance.package.hasHpText:
            tablist.append(
                Tab("Conference Homepage", Field("hpTextDE"),
                    Field("hpTextEN")))
        if instance.package.hasBooth:
            tablist.append(
                Tab("Booth", Field("wantBooth"), Field("boothTables"),
                    Field("boothChairs"), Field("boothBarTables"),
                    Field("boothComments")))
        if instance.package.hasRecruitingEvent:
            tablist.append(
                Tab(
                    "Recruiting",
                    Field("wantRecruting"),
                    Field("recruitingInfoDE"),
                    Field("recruitingInfoEN"),
                ))
        if instance.package.hasPackets:
            tablist.append(
                Tab(
                    "Parcel",
                    Field("packetInfo"),
                    HTML(
                        "<p class=\"text-info\">We will prepare approximately <strong>{} conference bags</strong>. If you send us less bag inserts, please briefly explain the way in which we should distribute your bag inserts.</p>\n<p class=\"text-info\">Please assure that no packets arrive before {} and use the following address to send us packets:</p>{{{{object.contact.companyName}}}}<br />c/o {}\n<br /><br />"
                        .format(
                            settings.NUMBER_OF_CONFERENCE_BAGS,
                            settings.PACKETS_DELIVERY_START.strftime(
                                "%a %b %d %Y"),
                            settings.CONFERENCE_VENUE_ADDRESS.replace(
                                "\n", "<br />"))),
                    HTML(
                        "<p class=\"text-info\">Please enter your parcel in the <a href=\"{}\"><span class=\"glyphicon glyphicon-list\"></span> <strong>tracking manager</strong></a> once you sent them to simplify our work and track whether we received your parcel.</p>"
                        .format(
                            reverse("sponsor_parcel_tracking",
                                    kwargs={"lpk": instance.pk})), ),
                ))
        if instance.package.hasProgramAd and instance.package.hasProgramAdText:
            tablist.append(
                Tab(
                    "Printed program",
                    textOptOutNotice,
                    HTML(
                        "<p class=\"text-info\">Please consider the following information regarding your advertisement in out printed program:<br />{{object.package.programAdInfo}}</p>"
                    ),
                    Field("programAd"),
                    HTML(
                        "<p class=\"text-info\">Additionally, you can enter a short description text of <strong>{{object.package.programAdTextNumWords}} words</strong> to describe your company."
                    ),
                    TextOptOut("programAdText"),
                ))
        elif instance.package.hasProgramAd:
            tablist.append(
                Tab(
                    "Printed program",
                    HTML(
                        "<p class=\"text-info\">Please consider the following information regarding your advertisement in out printed program:<br />{{object.package.programAdInfo}}</p>"
                    ),
                    Field("programAd"),
                ))
        elif instance.package.hasProgramAdText:
            tablist.append(
                Tab(
                    "Printed program",
                    textOptOutNotice,
                    HTML(
                        "<p class=\"text-info\">You can provide a short description text of <strong>{{object.package.programAdTextNumWords}} words</strong> to describe your company."
                    ),
                    TextOptOut("programAdText"),
                ), )
        if instance.package.hasParticipants:
            tablist.append(
                Tab(
                    "Participants",
                    HTML(
                        "<p class=\"text-info\">Partipants can be added/removed and listed in the <a href=\"{}\"><span class=\"glyphicon glyphicon-list\"></span> <strong>Partipants manager</strong></a>"
                        .format(
                            reverse("sponsor_participants",
                                    kwargs={"pk": instance.pk})))))

        actions = FormActions(Submit("Save", "Save changes"))

        self.helper.layout = Layout(TabHolder(*tablist), actions)
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        """
        Surcharge de l'initialisation du formulaire
        """
        super().__init__(*args, **kwargs)
        # Tu modifies le label de la date de naissance pour rajouter le format
        self.fields['birth_date'].label = "%s (JJ/MM/AAAA)" % "Date de naissance"
        # Tu utilises FormHelper pour customiser ton formulaire
        self.helper = FormHelper()
        # Tu définis l'id et la classe bootstrap de ton formulaire
        self.helper.form_class = 'form-horizontal'
        self.helper.form_id = 'registration-form'
        # Tu définis la taille des labels et des champs sur la grille
        self.helper.label_class = 'col-md-2'
        self.helper.field_class = 'col-md-8'
        # Tu crée l'affichage de ton formulaire
        self.helper.layout = Layout(
            # Le formulaire va contenir 3 onglets
            TabHolder(
                # Premier onglet
                Tab(
                    # Label de l'onglet
                    'Étape 1 - Identité',
                    # Liste des champs du modèle à afficher dans l'onglet
                    'civility',
                    'birth_name',
                    'last_name',
                    'first_name',
                    'birth_date',
                    'birth_place',
                    'birth_country',
                    # Tu rajoute un bouton "Suivant"
                    StrictButton(
                        '<span class="glyphicon glyphicon-arrow-right" \
                        aria-hidden="true"></span> %s' % "Suivant",
                        type='button',
                        css_class='btn-default col-md-offset-9 btnNext',
                    )

                ),
                # Deuxième onglet
                Tab(
                    # Label de l'onglet
                    'Étape 2 - Adresse',
                    # Liste des champs à afficher
                    'street_number',
                    'street_type',
                    'street',
                    'comp_1',
                    'comp_2',
                    'city',
                    'zip_code',
                    'country',
                    'phone',
                    # Tu rajoute des boutons "Précédent" et "Suivant"
                    StrictButton(
                        '<span class="glyphicon glyphicon-arrow-left" \
                        aria-hidden="true"></span> %s' % 'Précédent',
                        type='button',
                        css_class='btn-default btnPrevious',
                    ),
                    StrictButton(
                        '<span class="glyphicon glyphicon-arrow-right" \
                        aria-hidden="true"></span> %s' % 'Suivant',
                        type='button',
                        css_class='btn-default col-md-offset-8 btnNext',
                    )
                ),
                # Troisième onglet
                Tab(
                    # Label de l'onglet
                    'Étape 3 - Validation',
                    # Liste des champs à afficher dont les champs supplémentaires
                    'mail',
                    'confirmation_mail',
                    'comments',
                    'captcha',
                    # Tu rajoute des boutons "Précédent" et "Valider"
                    StrictButton(
                        '<span class="glyphicon glyphicon-arrow-left" \
                        aria-hidden="true"></span> %s' % "Précédent",
                        type='button',
                        css_class='btn-default btnPrevious',
                    ),
                    StrictButton(
                        '<span class="glyphicon glyphicon-ok" \
                        aria-hidden="true"></span> %s' % "Valider",
                        type='submit',
                        css_class='btn-default col-md-offset-8'
                    )
                ),
            ),
        )
Exemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request', None)
        self.object = kwargs.pop('object', None)

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

        self.fields['num_historia'] = forms.CharField(
            label=capfirst(_(u'N° Historia')), required=True,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['veterinario'] = forms.CharField(
            label=capfirst(_(u'veterinario')), required=True,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['nombre'] = forms.CharField(
            label=capfirst(_(u'nombre')), required=True,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['duenho'] = forms.ChoiceField(
            label=capfirst(_(u'duenho')), required=True,
            # widget=forms.RadioSelect(),

            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['edad'] = forms.CharField(
            label=capfirst(_(u'edad')), required=False,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['genero'] = forms.CharField(
            label=capfirst(_(u'genero')), required=False,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['especie'] = forms.CharField(
            label=capfirst(_(u'especie')), required=False,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['raza'] = forms.CharField(
            label=capfirst(_(u'raza')), required=False,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        self.fields['color'] = forms.CharField(
            label=capfirst(_(u'color')), required=False,
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )


        self.helper = FormHelper()
        self.helper.layout = Layout(
            TabHolder(
                Tab(_('Perfil'),
                    Row(
                        Div(Div(HTML('''
                                <img src="/media/clivet/images.jpg"" alt="{{ form.nombre.value}}" class="img-responsive">
                                '''),
                                Div(HTML('''
                                    <h3>{{ form.nombre.value}}</h3>
                                    <p><strong>{{ form.num_historia.label }}</strong>: {{ form.num_historia.value}}</p>
                                    <button type="button" class="btn btn-info btn-lg">
                                        <i class="fa fa-calendar" aria-hidden="true"></i>
                                    </button>
                                    <button type="button" class="btn btn-warning btn-lg">
                                        <i class="fa fa-hospital-o" aria-hidden="true"></i>
                                    </button>
                                    '''
                                    ),
                                css_class='caption text-center'),
                                css_class='thumbnail'),
                            css_class='col-md-6 col-md-3 '),
                        Div(HTML('''
                                {% include "clinica/includes/tablaperfil.html" %}
                                '''),
                            css_class='col-md-5 panel panel-default'),
                        Div(HTML('''
                                {% include "clinica/includes/tablasreport.html" %}
                                '''),
                            css_class='col-md-4'),
                    ),
                ),
                Tab(_('Historial de Compras'),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.num_historia.label }} </label>
                                <div class="controls ">{{ form.num_historia.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.created_ath.label }} </label>
                                <div class="controls ">{{ form.created_ath.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.veterinario.label }} </label>
                                <div class="controls ">{{ form.veterinario.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                ),
                Tab(_('Historia Clinico'),
                    Row(
                        Div(HTML('''
                                 {% include "clinica/includes/atencion.html" %}
                                 '''
                                 ),
                            ),
                        ),
                ),
                Tab(_('Agenda Medica'),
                ),
            ),
        )
Exemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    'Main Fields',
                    'manufacturer',
                    'manufacturer_product_code',
                    'manufacturer_serial_number',
                    'week_of_manufacture',
                    'year_of_manufacture',
                    'version',
                    'monitor_name',
                    'monitor_serial_number',
                    'monitor_data_string',
                ),
                Tab(
                    'Basic Display Parameters',
                    InlineRadios('bdp_video_input'),
                    'bdp_signal_level_standard',
                    'bdp_blank_to_black_setup',
                    'bdp_separate_syncs',
                    'bdp_composite_sync',
                    'bdp_sync_on_green_video',
                    'bdp_vsync_serration',
                    'bdp_video_input_dfp_1',
                    AppendedText('bdp_max_horizontal_image_size', 'cm'),
                    AppendedText('bdp_max_vertical_image_size', 'cm'),
                    'bdp_display_gamma',
                    'bdp_feature_display_type',
                    'bdp_feature_standby',
                    'bdp_feature_suspend',
                    'bdp_feature_active_off',
                    'bdp_feature_standard_srgb',
                    'bdp_feature_pref_timing_mode',
                    'bdp_feature_default_gtf',
                ),
                Tab(
                    'Chromaticity',
                    'chr_red_x',
                    'chr_red_y',
                    'chr_green_x',
                    'chr_green_y',
                    'chr_blue_x',
                    'chr_blue_y',
                    'chr_white_x',
                    'chr_white_y',
                ),
                Tab(
                    'Established Timings',
                    'est_timings_720_400_70',
                    'est_timings_720_400_88',
                    'est_timings_640_480_60',
                    'est_timings_640_480_67',
                    'est_timings_640_480_72',
                    'est_timings_640_480_75',
                    'est_timings_800_600_56',
                    'est_timings_800_600_60',
                    'est_timings_800_600_72',
                    'est_timings_800_600_75',
                    'est_timings_832_624_75',
                    'est_timings_1024_768_87',
                    'est_timings_1024_768_60',
                    'est_timings_1024_768_70',
                    'est_timings_1024_768_75',
                    'est_timings_1280_1024_75',
                ),
                Tab(
                    'Monitor Range Limits',
                    'monitor_range_limits',
                    AppendedText('mrl_min_horizontal_rate', 'kHz'),
                    AppendedText('mrl_max_horizontal_rate', 'kHz'),
                    AppendedText('mrl_min_vertical_rate', 'Hz'),
                    AppendedText('mrl_max_vertical_rate', 'Hz'),
                    AppendedText('mrl_max_pixel_clock', 'MHz'),
                    'mrl_secondary_gtf_curve_support',
                    AppendedText('mrl_secondary_gtf_start_freq', 'kHz'),
                    'mrl_secondary_gtf_c',
                    'mrl_secondary_gtf_m',
                    'mrl_secondary_gtf_k',
                    'mrl_secondary_gtf_j',
                )),
            FormActions(
                Submit('submit', 'Submit'),
                HTML('<a class="btn" href="'
                     "{% url 'edid-detail' form.instance.pk %}"
                     '">Cancel</a>'),
            ))
        super(EDIDUpdateForm, self).__init__(*args, **kwargs)

        # ID Serial Number, 32-bit
        # MinValueValidator is added by field type PositiveIntegerField
        self.fields['manufacturer_serial_number'].validators.append(
            MaxValueValidator(4294967295))

        # Year of manufacture, 1990-2245
        self.fields['year_of_manufacture'].validators.append(
            MinValueValidator(1990))
        self.fields['year_of_manufacture'].validators.append(
            MaxValueValidator(2245))

        ### bdp=Basic display parameters
        self.fields['bdp_max_horizontal_image_size'].validators.append(
            MaxValueValidator(255))
        self.fields['bdp_max_vertical_image_size'].validators.append(
            MaxValueValidator(255))

        self.fields['bdp_display_gamma'].validators.append(
            MinValueValidator(1.00))
        self.fields['bdp_display_gamma'].validators.append(
            MaxValueValidator(3.54))

        ### chr=Chromaticity
        for chr_color in [
                'chr_red_x', 'chr_red_y', 'chr_green_x', 'chr_green_y',
                'chr_blue_x', 'chr_blue_y', 'chr_white_x', 'chr_white_y'
        ]:
            self.fields[chr_color].validators.append(MinValueValidator(0.0))
            self.fields[chr_color].validators.append(MaxValueValidator(0.999))

        ### mrl=Monitor range limits
        self.fields['mrl_min_horizontal_rate'].validators.append(
            MinValueValidator(1))
        self.fields['mrl_min_horizontal_rate'].validators.append(
            MaxValueValidator(255))

        self.fields['mrl_max_horizontal_rate'].validators.append(
            MinValueValidator(1))
        self.fields['mrl_max_horizontal_rate'].validators.append(
            MaxValueValidator(255))

        self.fields['mrl_min_vertical_rate'].validators.append(
            MinValueValidator(1))
        self.fields['mrl_min_vertical_rate'].validators.append(
            MaxValueValidator(255))

        self.fields['mrl_max_vertical_rate'].validators.append(
            MinValueValidator(1))
        self.fields['mrl_max_vertical_rate'].validators.append(
            MaxValueValidator(255))

        self.fields['mrl_max_pixel_clock'].validators.append(
            MinValueValidator(10))
        self.fields['mrl_max_pixel_clock'].validators.append(
            MaxValueValidator(255))

        self.fields['mrl_secondary_gtf_start_freq'].validators.append(
            MaxValueValidator(510))

        self.fields['mrl_secondary_gtf_c'].validators.append(
            MaxValueValidator(127))
        self.fields['mrl_secondary_gtf_m'].validators.append(
            MaxValueValidator(65535))
        self.fields['mrl_secondary_gtf_k'].validators.append(
            MaxValueValidator(255))
        self.fields['mrl_secondary_gtf_j'].validators.append(
            MaxValueValidator(127))
Exemplo n.º 5
0
    def __init__(self, *args, **kwargs):
        super(SearchTeacherForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        # self.helper.form_id = 'test'
        self.helper.form_method = 'get'
        self.helper.form_id = 'search-teachers-form'
        # self.helper.form_action = reverse('Home')
        # self.helper.add_input(Submit('submit', value='Refresh', css_class='col-sm-4 col-sm-offset-1'))
        # reset = Reset('reset', 'Reset', css_class='col-sm-4 col-sm-offset-1')
        # reset = Button('reset', 'Reset', css_class='col-sm-4 col-sm-offset-1')
        # reset = Submit('reset', 'Reset', css_class='col-sm-4 col-sm-offset-1')
        # self.helper.add_input(reset)
        # self.helper.form_class = 'form-horizontal'
        # self.helper.form_class = 'search'
        self.helper.form_class = 'search'

        self.helper.layout = Layout(
            TabHolder(

                # Tab('gender',
                #     Div(InlineCheckboxes('gender'), css_class='col-xs-12 col-md-12 col-lg-12'),
                # ),
                Tab(
                    'Subject/Level',
                    # HTML("""<br>test<br>"""),
                    HTML(
                        """<div class="col-xs-12 col-12 col-lg-12"><h4><label>Subject</label></h4></div>"""
                    ),
                    Div(Field('subject_1'),
                        css_class='col-xs-12 col-sm-4 col-lg-4'),
                    Div(Field('subject_2'),
                        css_class='col-xs-12 col-sm-4 col-lg-4'),
                    Div(Field('subject_3'),
                        css_class='col-xs-12 col-sm-4 col-lg-4'),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><h4><label>Level</label></h4></div>"""
                    ),
                    # Div(InlineRadios('level_grp'), css_class='col-xs-12 col-md-12 col-lg-12'),
                    Div(InlineRadios('level'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),
                    ButtonHolder(
                        HTML(
                            '<a class="btn btn-default col-xs-12 col-sm-4 col-sm-offset-4 extra-top-15" href="{% url "TeacherList" %}">Reset</a>'
                        ), ),
                ),
                Tab(
                    'Region',

                    # Div(InlineCheckboxes('region'), css_class='col-xs-12 col-md-12 col-lg-12'),
                    HTML(
                        """<div class="col-xs-12 col-md-12"><h4><label>Region Availabilty</label></h4></div>"""
                    ),
                    Div(InlineCheckboxes('region_1'),
                        css_class='col-xs-12 col-sm-6'),
                    Div(InlineCheckboxes('region_2'),
                        css_class='col-xs-12 col-sm-6'),
                    Div(InlineCheckboxes('region_3'),
                        css_class='col-xs-12 col-sm-6'),
                    Div(InlineCheckboxes('region_4'),
                        css_class='col-xs-12 col-sm-6'),
                    ButtonHolder(
                        HTML(
                            '<a class="btn btn-default col-xs-12 col-sm-4 col-sm-offset-4 extra-top-15" href="{% url "TeacherList" %}">Reset</a>'
                        ), ),
                ),
                Tab(
                    'Other Details',
                    HTML(
                        """<div class="col-xs-12 col-sm-12"><h4><label>Other Details</label></h4></div>"""
                    ),
                    Div(Field('minimum_years'),
                        css_class='col-xs-12 col-sm-4'),
                    Div(Field('maximum_pay'), css_class='col-xs-12 col-sm-4'),

                    # HTML("""<div class="col-xs-12 col-sm-12"><h4><label>Group Tuition</label></h4></div>"""),
                    Div(InlineRadios('group_tuition'),
                        css_class=
                        'col-xs-12 col-sm-offset-1 col-sm-2 col-sm-offset-1'),
                    HTML(
                        """<div class="col-xs-12 col-sm-12"><h4><label>Education and Expertise</label></h4></div>"""
                    ),
                    # HTML("""<div class="col-xs-12 col-sm-12"><span><p><b>Tutors education</b></p></span></div>"""),
                    Div(InlineCheckboxes('educational_level'),
                        css_class='col-xs-12 col-sm-6'),

                    # HTML("""<div class="col-xs-12 col-sm-12"><span><p><b>Tutors current role</b></p></span></div>"""),
                    Div(InlineCheckboxes('expertise_type'),
                        css_class='col-xs-12 col-sm-6'),

                    # HTML("""<div class="col-xs-12 col-sm-12"><h4><label>Group Tuition</label></h4></div>"""),
                    # Div(Field('group_tuition'), css_class='col-xs-12 col-sm-6'),
                    ButtonHolder(
                        HTML(
                            '<a class="btn btn-default col-xs-12 col-sm-4 col-sm-offset-4 extra-top-15" href="{% url "TeacherList" %}">Reset</a>'
                        ), ),
                ),
                Tab(
                    'Keyword',
                    Div(Field('search'),
                        css_class=
                        'col-xs-12 col-sm-offset-3 col-sm-6 col-sm-offset-3'),
                    ButtonHolder(
                        Submit(
                            'submit',
                            'Search',
                            css_class=
                            'col-xs-12 col-sm-offset-4 col-sm-4 col-sm-offset-4'
                        )  #,
                        # HTML('<a class="btn btn-default col-xs-4 col-xs-offset-1 extra-top-15" href="{% url "TeacherList" %}">Reset</a>'),
                    ),
                ),
            ),

            # ButtonHolder(
            #     Submit('submit', 'Refresh', css_class='col-xs-4 col-xs-offset-1'),
            #     HTML('<a class="btn btn-default col-xs-4 col-xs-offset-1" href="{% url "TeacherList" %}">Reset</a>'),
            # ),
        )
Exemplo n.º 6
0
    def __init__(self,
                 add,
                 minm=None,
                 maxm=None,
                 labels=None,
                 *args,
                 **kwargs):
        self.add = add
        self.minm = minm
        self.maxm = maxm
        self.old_labels = labels
        super(HMFInput, self).__init__(*args, **kwargs)

        if self.old_labels:
            self.fields['label'] = forms.CharField(
                label="Label",
                initial="new-" + self.old_labels[-1],
                help_text="A base label for this calculation",
                max_length=25)
        else:
            self.fields['label'] = forms.CharField(
                label="Label",
                initial="PLANCK-SMT",
                help_text="A base label for this calculation",
                max_length=25)
        if add == 'create':
            # Then we wnat to display min_M and max_M
            self.fields['Mmin'] = forms.FloatField(
                label="",
                initial=10.0,
                help_text=mark_safe(
                    "Units of log<sub>10</sub>(M<sub>&#9737</sub>)"),
                min_value=3.0,
                max_value=18.0)
            self.fields['Mmax'] = forms.FloatField(label="",
                                                   initial=15.0,
                                                   help_text="",
                                                   min_value=3.0,
                                                   max_value=18.0)
            self.fields['dlog10m'] = forms.FloatField(label="",
                                                      initial=0.05,
                                                      help_text="",
                                                      min_value=0.00001,
                                                      max_value=15.0)

        self.helper = FormHelper()
        self.helper.form_id = 'input_form'
        self.helper.form_class = 'form-horizontal'
        self.helper.form_method = 'post'

        self.helper.help_text_inline = True
        self.helper.label_class = "col-md-3 control-label"
        self.helper.field_class = "col-md-8"

        k_html = HTML(
            mark_safe("""
<div class="form-group">
    <label for="id_lnk_min" class="col-md-3 control-label">Min|Max|&#916 (lnk)</label>
    <div class="col-md-9">
        <div class="form-group row">
            <div class="col-md-4">
                <input class="form-control" id="id_lnk_min" name="lnk_min" type="text" value="-15" />
                
            </div>
            <div class="col-md-4">
                <input class="form-control" id="id_lnk_max" name="lnk_max" type="text" value="15" />
            </div>
            <div class="col-md-4">
                <input class="form-control" id="id_dlnk" name="dlnk" type="text" value="0.05" />
            </div>
        </div>
    </div>    
</div>
"""))
        m_html = HTML(
            mark_safe("""
<div class="form-group">
    <label for="id_lnk_min" class="col-md-3 control-label">Min|Max|&#916 (log<sub>10</sub>M<sub>&#9737</sub>)</label>
    <div class="col-md-9">
        <div class="form-group row">
            <div class="col-md-4">
                <input class="form-control" id="id_Mmin" name="Mmin" type="text" value="10" />
            </div>
            <div class="col-md-4">
                <input class="form-control" id="id_Mmax" name="Mmax" type="text" value="15" />
            </div>
            <div class="col-md-4">
                <input class="form-control" id="id_dlog10m" name="dlog10m" type="text" value="0.05" />
            </div>
        </div>
    </div>    
</div>
"""))
        if add == 'create':
            d = Div('wdm_mass',
                    k_html,
                    m_html,
                    'cut_fit',
                    css_class='col-md-6')
        else:
            d = Div('wdm_mass', k_html, 'cut_fit', css_class='col-md-6')

        self.helper.layout = Layout(
            "label",
            TabHolder(
                Tab(
                    'Run Parameters',
                    Div(
                        Div('z',
                            'delta_h',
                            'delta_wrt',
                            'mf_fit',
                            css_class='col-md-6'), d)),
                Tab(
                    'Cosmological Parameters',
                    Div(
                        Div('transfer_file',
                            'transfer_file_upload',
                            'transfer_fit',
                            'delta_c',
                            'n',
                            css_class='col-md-6'),
                        Div('sigma_8',
                            'H0',
                            'omegab',
                            'omegac',
                            'omegav',
                            css_class='col-md-6')))),
            FormActions(Submit('submit', 'Calculate!', css_class='btn-large')))
        self.helper.form_action = ''
Exemplo n.º 7
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.layout = Layout(
            Fieldset(
                'Summary',
                'manufacturer',
                'model',
                'disambiguation',
                'introduced',
                'discontinued',
                'format',
                'negative_size',
            ),
            Div(
                TabHolder(
                    Tab(
                        'Interchangeable lens',
                        Fieldset(
                            'Lens mount',
                            'mount',
                        ),
                    ),
                    Tab(
                        'Fixed lens',
                        Fieldset(
                            'Lens',
                            'lens_manufacturer',
                            'lens_model_name',
                        ),
                        Fieldset(
                            'Optics',
                            'zoom',
                            AppendedText('min_focal_length', 'mm'),
                            AppendedText('max_focal_length', 'mm'),
                            PrependedText('max_aperture', 'f/'),
                            PrependedText('min_aperture', 'f/'),
                            AppendedText('closest_focus', 'm'),
                            'elements',
                            'groups',
                            AppendedText('nominal_min_angle_diag', '&deg;'),
                            AppendedText('nominal_max_angle_diag', '&deg;'),
                            'aperture_blades',
                            'coating',
                            AppendedText('magnification', '&times;'),
                        ),
                        Fieldset(
                            'Physical',
                            AppendedText('filter_thread', 'mm'),
                            'hood',
                        ),
                    ),
                ),
                css_class="border",
            ), Fieldset(
                'Physical',
                'body_type',
                AppendedText('weight', 'g'),
            ),
            Fieldset(
                'Focus',
                'focus_type',
                'af_points',
                AppendedText('viewfinder_coverage', '%'),
            ),
            Fieldset(
                'Metering',
                'metering',
                'metering_type',
                'min_iso',
                'max_iso',
                'dx_code',
                'meter_min_ev',
                'meter_max_ev',
                InlineCheckboxes('metering_modes'),
                InlineCheckboxes('exposure_programs'),
            ),
            Fieldset(
                'Shutter',
                'shutter_type',
                'shutter_model',
                'fastest_shutter_speed',
                'slowest_shutter_speed',
                'bulb',
                'time',
            ),
            Fieldset(
                'Film transport',
                'internal_power_drive',
                AppendedText('continuous_fps', 'fps'),
                'external_power_drive',
            ), Fieldset(
                'Power',
                'battery_qty',
                'battery_type',
            ),
            Fieldset(
                'Flash',
                'int_flash',
                AppendedText('int_flash_gn', 'm'),
                'ext_flash',
                'pc_sync',
                'shoe',
                'x_sync',
            ),
            Fieldset(
                'Features',
                'dof_preview',
                'mirror_lockup',
                'tripod',
                'self_timer',
                'date_imprint',
                'cable_release',
                'interchangeable_backs',
                'interchangeable_finders',
                'strap_lugs',
                'multiple_exposures',
            ),
            Fieldset(
                'Misc',
                'notes',
                'tags',
                'link',
                'image',
                'image_attribution',
                'image_attribution_link',
            ), FormActionButtons)
Exemplo n.º 8
0
    def __init__(self, user, *args, **kwargs):
        super(CampaignForm, self).__init__(*args, **kwargs)
        self.user = user
        self.helper = FormHelper()
        if self.instance.id:
            form_action = common_submit_buttons(default_action='update')
        else:
            form_action = common_submit_buttons(default_action='add')

        week_days = [
            'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday',
            'sunday'
        ]
        week_days_html = """<div class="row"><div class="col-md-12 col-xs-6">"""

        for i in week_days:
            week_days_html += """
                <div class="col-md-3">
                    <div class="btn-group" data-toggle="buttons">
                        <label for="{{ form.%s.auto_id }}">{{ form.%s.label }}</label><br/>
                        <div class="make-switch switch-small">
                        {{ form.%s }}
                        </div>
                    </div>
                </div>
                """ % (i, i, i)
        week_days_html += """</div></div>"""
        css_class = 'col-md-6'

        self.helper.layout = Layout(
            Field('campaign_code'),
            TabHolder(
                Tab(_('general').title(),
                    Div(Div(Fieldset(_('general settings').title()),
                            css_class='col-md-12'),
                        Div('name', css_class=css_class),
                        Div('callerid', css_class=css_class),
                        Div('caller_name', css_class=css_class),
                        Div('content_object', css_class=css_class),
                        css_class='row'),
                    Div(Div('extra_data', css_class=css_class),
                        Div('dnc', css_class=css_class),
                        Div('description', css_class=css_class),
                        Div('phonebook', css_class=css_class),
                        css_class='row'),
                    form_action,
                    css_class='well'),
                Tab('Dialer',
                    Div(Div(Fieldset(_('dialer settings').title()),
                            css_class='col-md-12'),
                        Div('aleg_gateway', css_class=css_class),
                        Div('frequency', css_class=css_class),
                        Div('callmaxduration', css_class=css_class),
                        Div('maxretry', css_class=css_class),
                        Div('intervalretry', css_class=css_class),
                        Div('calltimeout', css_class=css_class),
                        Div(Fieldset(_('dialer completion settings').title()),
                            css_class='col-md-12'),
                        Div('completion_maxretry', css_class=css_class),
                        Div('completion_intervalretry', css_class=css_class),
                        Div('sms_gateway', css_class=css_class),
                        css_class='row'),
                    form_action,
                    css_class='well'),
                Tab('schedule',
                    Div(Div(Fieldset(_('schedule settings').title()),
                            css_class='col-md-12'),
                        Div(HTML("""<label>%s<label>""" %
                                 (_('week days').capitalize())),
                            css_class="col-md-3"),
                        HTML(week_days_html),
                        HTML("""<div>&nbsp;</div>"""),
                        Div('startingdate', css_class=css_class),
                        Div('expirationdate', css_class=css_class),
                        Div('daily_start_time', css_class=css_class),
                        Div('daily_stop_time', css_class=css_class),
                        css_class='row'),
                    form_action,
                    css_class='well'),
            ),
        )

        if settings.AMD:
            amd_layot = Tab(_('voicemail').capitalize(),
                            Div(Div(Fieldset(_('voicemail settings').title()),
                                    css_class='col-md-12'),
                                Div(HTML("""
                                    <div class="btn-group" data-toggle="buttons">
                                        <label for="{{ form.voicemail.auto_id }}">{{ form.voicemail.label }}</label>
                                        <br/>
                                        <div class="make-switch switch-small">
                                        {{ form.voicemail }}
                                        </div>
                                    </div>
                                    """),
                                    css_class='col-md-12 col-xs-10'),
                                HTML("""<div>&nbsp;</div>"""),
                                Div('amd_behavior', css_class=css_class),
                                Div('voicemail_audiofile',
                                    css_class=css_class),
                                css_class='row'),
                            form_action,
                            css_class='well')
            self.helper.layout[1].insert(2, amd_layot)
        # hidden var
        self.helper.layout.append(Field('selected_phonebook'))
        self.helper.layout.append(Field('selected_content_object'))

        instance = getattr(self, 'instance', None)
        self.fields['campaign_code'].initial = get_unique_code(length=5)

        if user:
            list_gw = []
            dnc_list = []
            phonebook_list = get_phonebook_list(user)
            if not phonebook_list:
                phonebook_list = []
                phonebook_list.append(('', '---'))

            self.fields['phonebook'].choices = phonebook_list
            self.fields['phonebook'].initial = str(phonebook_list[0][0])

            gateway_list = UserProfile.objects.get(
                user=user).userprofile_gateway.all()
            gw_list = ((l.id, l.name) for l in gateway_list)

            dnc_list.append(('', '---'))
            dnc_obj_list = DNC.objects.values_list(
                'id', 'name').filter(user=user).order_by('id')
            for l in dnc_obj_list:
                dnc_list.append((l[0], l[1]))
            self.fields['dnc'].choices = dnc_list

            for i in gw_list:
                list_gw.append((i[0], i[1]))
            self.fields['aleg_gateway'].choices = UserProfile.objects.get(user=user)\
                .userprofile_gateway.all().values_list('id', 'name')

            if instance.has_been_duplicated:
                from survey.models import Survey
                available_objects = Survey.objects.filter(user=user,
                                                          campaign=instance)
                object_choices = get_object_choices(available_objects)
                self.fields['content_object'].widget.attrs['readonly'] = True
            else:
                from survey.models import Survey_template
                available_objects = Survey_template.objects.filter(user=user)
                object_choices = get_object_choices(available_objects)

            self.fields['content_object'].choices = object_choices

            # Voicemail setting is not enabled by default
            if settings.AMD:
                from survey.forms import get_audiofile_list
                self.fields[
                    'voicemail_audiofile'].choices = get_audiofile_list(user)

        # If campaign is running or has been started
        if instance.status == CAMPAIGN_STATUS.START or instance.has_been_started:
            self.fields['name'].widget.attrs['readonly'] = True
            self.fields['caller_name'].widget.attrs['readonly'] = True
            self.fields['callerid'].widget.attrs['readonly'] = True
            self.fields['extra_data'].widget.attrs['readonly'] = True
            self.fields['phonebook'].widget.attrs['readonly'] = True
            self.fields['lead_disposition'].widget.attrs['readonly'] = True
            self.fields['dnc'].widget.attrs['readonly'] = True
            self.fields['aleg_gateway'].widget.attrs['readonly'] = True
            self.fields['sms_gateway'].widget.attrs['readonly'] = True
            self.fields['voicemail'].widget.attrs['readonly'] = True
            self.fields['amd_behavior'].widget.attrs['readonly'] = True
            self.fields['voicemail_audiofile'].widget.attrs['readonly'] = True

            selected_phonebook = ''
            if instance.phonebook.all():
                selected_phonebook = ",".join(
                    ["%s" % (i.id) for i in instance.phonebook.all()])
            self.fields['selected_phonebook'].initial = selected_phonebook

            self.fields['content_object'].widget.attrs['disabled'] = 'disabled'
            self.fields['content_object'].required = False
            self.fields['selected_content_object'].initial = "type:%s-id:%s" % \
                (instance.content_type.id, instance.object_id)
Exemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        super(RegistrationForm, self).__init__(*args, **kwargs)
        self.fields['first_name'] = forms.CharField(
            label=capfirst(_(u'first name')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['last_name'] = forms.CharField(
            label=capfirst(_(u'last name')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['identity_num'] = forms.CharField(
            label=dict((x, y) for x, y in IDENTITY_TYPE_CHOICES)[NID],
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['association_name'] = forms.CharField(
            label=capfirst(_(u'Association')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['enterprise_name'] = forms.CharField(
            label=capfirst(_(u'Enterprise')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['enterprise_tax_id'] = forms.CharField(
            label=capfirst(_(u'Tax id')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['enterprise_type_e'] = forms.ChoiceField(
            label=capfirst(_(u'Type')),
            required=True,
            # widget=forms.RadioSelect(),
            choices=(('', '----------'), ) + TYPE_CHOICES,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['solution'] = forms.ModelChoiceField(
            label=capfirst(_(u'Solution')),
            required=True,
            queryset=Solution.objects.filter(is_active=True),
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['acept'] = forms.BooleanField(
            label=capfirst(
                _(u'I accept the Terms of Service and Privacy Policy.')),
            required=True,
            # widget=forms.CheckboxInput(),
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['photo'] = forms.ImageField(
            label=capfirst(_(u'Photo')),
            required=False,
            initial='persons/default.png',
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Available formats are JPG, GIF, and PNG.'),
        )

        self.helper = FormHelper()
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    _('Account Info'),
                    Row(
                        Div(Field('username',
                                  autofocus=True,
                                  css_class='input-required'),
                            css_class='col-md-6'),
                        Div(Field('email', ), css_class='col-md-6'),
                    ),
                    Row(
                        Div(Field('password1', ), css_class='col-md-6'),
                        Div(Field('password2', ), css_class='col-md-6'),
                    ),
                    Row(
                        Div(Field('enterprise_name', ), css_class='col-md-6'),
                        Div(Field('enterprise_tax_id', ),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(Field('association_name', ), css_class='col-md-6'),
                        Div(Field('enterprise_type_e', ),
                            css_class='col-md-6'),
                    ),
                    Row(Div(Field('solution', ), css_class='col-md-6'), ),
                ),
                Tab(
                    _('Personal Info'),
                    Row(
                        Div(Field('first_name', ), css_class='col-md-6'),
                        Div(Field('last_name', ), css_class='col-md-6'),
                    ),
                    Row(Div(Field('identity_num', ), css_class='col-md-6'), ),
                ),
                Tab(_('Image'), Field('photo', css_class="")),
            ),
            Row(Div(Field('acept', ), css_class='col-md-12'), ),
            FormActions(
                Submit('submit',
                       _('Sign up'),
                       css_class='btn-success pull-right'), ),
        )
Exemplo n.º 10
0
 def __init__(self, *args, **kwargs):
     super(LeadForm, self).__init__(*args, **kwargs)
     clientPopupUrl = reverse("crm:client_organisation_company_popup")
     self.helper.layout = Layout(
         TabHolder(
             Tab(
                 _("Identification"),
                 Column(Field(
                     "name",
                     placeholder=mark_safe(
                         _("Name of the lead. don't include client name"))),
                        css_class="col-md-12"),
                 Column(FieldWithButtons(
                     "client",
                     HTML(
                         "<a role='button' class='btn btn-default' href='%s' data-remote='false' data-toggle='modal' data-target='#clientModal'><span class='glyphicon glyphicon-plus'></span></a>"
                         % clientPopupUrl)),
                        css_class="col-md-6"),
                 Column("subsidiary", css_class="col-md-6"),
                 Column("description", css_class="col-md-6"),
                 Column("administrative_notes", css_class="col-md-6"),
                 Column(Field(
                     "action",
                     placeholder=_("Next commercial action to be done")),
                        css_class="col-md-6")),
             Tab(
                 _("State and tracking"),
                 Div(
                     Column(
                         "responsible",
                         Field("due_date",
                               placeholder=_("Due date for next step"),
                               css_class="datepicker"),
                         Field(
                             "start_date",
                             placeholder=_("Date of the operational start"),
                             css_class="datepicker"),
                         css_class='col-md-6'),
                     Column(Field(
                         "deal_id",
                         placeholder=_("Leave blank to auto generate")),
                            Field(
                                "client_deal_id",
                                placeholder=_("Internal client reference")),
                            "state",
                            css_class='col-md-6'))),
             Tab(
                 _("Commercial"),
                 Div(
                     Column(AppendedText("sales", "k€"),
                            "salesman",
                            css_class='col-md-6'),
                     Column(FieldWithButtons(
                         "business_broker",
                         HTML(
                             "<a role='button' class='btn btn-default' href='%s' target='_blank'><span class='glyphicon glyphicon-plus'></span></a>"
                             % reverse("crm:businessbroker_create"))),
                            FieldWithButtons(
                                "paying_authority",
                                HTML(
                                    "<a role='button' class='btn btn-default' href='%s' target='_blank'><span class='glyphicon glyphicon-plus'></span></a>"
                                    %
                                    reverse("crm:businessbroker_create"))),
                            css_class='col-md-6'))),
             Tab(
                 _("Staffing"),
                 Div(Field(
                     "staffing",
                     placeholder=_("People that could contribute...")),
                     Field(
                         "external_staffing",
                         placeholder=
                         _("People outside company that could contribute..."
                           )),
                     css_class="col-md-6"))),
         Fieldset("", "send_email"),
         Field("tags", css_class="hide"
               ),  # Don't use type=hidden, it breaks tag parsing.
         self.submit)
Exemplo n.º 11
0
    def __init__(self, user, *args, **kwargs):
        super(SMSCampaignForm, self).__init__(*args, **kwargs)
        self.user = user
        self.helper = FormHelper()

        if self.instance.id:
            form_action = common_submit_buttons(default_action='update')
        else:
            form_action = common_submit_buttons(default_action='add')

        week_days = [
            'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday',
            'sunday'
        ]
        week_days_html = """<div class="row"><div class="col-md-12 col-xs-6">"""

        for i in week_days:
            week_days_html += """
                <div class="col-md-3">
                    <div class="btn-group" data-toggle="buttons">
                        <label for="{{ form.%s.auto_id }}">{{ form.%s.label }}</label><br/>
                        <div class="make-switch switch-small">
                        {{ form.%s }}
                        </div>
                    </div>
                </div>
                """ % (i, i, i)

        week_days_html += """</div></div>"""
        css_class = 'col-md-6'
        self.helper.layout = Layout(
            Field('campaign_code'),
            TabHolder(
                Tab(_('general settings').title(),
                    Div(Div('name', css_class=css_class),
                        Div('callerid', css_class=css_class),
                        Div('sms_gateway', css_class=css_class),
                        Div('phonebook', css_class=css_class),
                        Div('extra_data', css_class=css_class),
                        Div('text_message', css_class=css_class),
                        css_class='row'),
                    form_action,
                    css_class='well'),
                Tab(_('completion settings').title(),
                    Div(Div('frequency', css_class=css_class),
                        Div('maxretry', css_class=css_class),
                        Div('intervalretry', css_class=css_class),
                        css_class='row'),
                    form_action,
                    css_class='well'),
                Tab('schedule',
                    Div(Div(HTML("""<label>%s<label>""" %
                                 (_('week days').capitalize())),
                            css_class="col-md-3"),
                        HTML(week_days_html),
                        HTML("""<div>&nbsp;</div>"""),
                        Div('startingdate', css_class=css_class),
                        Div('expirationdate', css_class=css_class),
                        Div('daily_start_time', css_class=css_class),
                        Div('daily_stop_time', css_class=css_class),
                        css_class='row'),
                    form_action,
                    css_class='well'),
            ),
        )

        self.fields['campaign_code'].initial = get_unique_code(length=5)
        if user:
            phonebook_list = get_phonebook_list(user)
            self.fields['phonebook'].choices = phonebook_list
            self.fields['phonebook'].initial = str(phonebook_list[0][0])
Exemplo n.º 12
0
    def __init__(self,  *args, **kwargs):
        super(IncidentForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    'Incidence Description',
                    Div(
                        'vehicle', 
                        'driver', 
                        'incident_date', 
                        'time_of_incident',
                        'location',                         
                                                                     
                        css_class = "col-md-6"
                        ),
                    Div( 
                        'incident_type',
                        'case_number',
                        'date_reported', 
                        'police_station',  
                        'damage_extent',
                        'no_claim',                        
                        css_class = "col-md-6",
                        ),
                     HTML('<a  href="#incidence-damge-description" data-toggle="tab" onclick="newTabToggle()" aria-expanded="true">Next Tab <i class="fa fa-forward" aria-hidden="true"></i></a>'), 
                        
                ),
                Tab(
                    'Incidence Damage Description',
                    Div('Description',),
                    Div(
                        'left_rear_fender', 
                        'left_rear_wheel', 
                        'left_rear_door', 
                        'left_rear_lamp', 
                        'left_rear_window',
                        'left_rear_door_window', 
                        'left_rear_viewmirror', 
                        'left_front_door_window', 
                        'left_front_door', 
                        'left_front_wheel',
                        'left_front_fender', 
                        'left_head_lamp',                       
                        css_class = "col-md-3"
                        ),
                    Div(
                        
                        'right_rear_fender',
                        'right_rear_wheel', 
                        'right_rear_door', 
                        'right_rear_lamp', 
                        'right_rear_window', 
                        'right_rear_door_window',
                        'right_rear_viewmirror', 
                        'right_front_door_window', 
                        'right_front_door', 
                        'right_front_wheel', 
                        'right_front_fender',
                        'right_head_lamp',
                        css_class = "col-md-3"
                        ),
                    Div(
                        'rear_bumper', 
                        'boot_door', 
                        'rear_wind_screen', 
                        'car_top', 
                        'wind_screen',
                        'hood', 
                        'grill', 
                        'front_bumper',
                        'chasis',
                        'suspension',
                        'engine',
                        'gear_box',
                        css_class = "col-md-3"
                        ),
                    Div(
                        'dashboard' ,
                        'dashboard_controls',
                        'sound_system',
                        'Steering',
                        'left_front_seat',
                        'rear_seat',
                        'right_front_seat',
                        'door_panels',
                        'foot_pedals',
                        'hand_brake',
                        'capets',
                        'ceiling',
                         css_class = "col-md-3"
                        ), 
                   
                    HTML('<a  href="#incidence-description" data-toggle="tab" aria-expanded="true" onclick="newTabToggle()"><i class="fa fa-backward" aria-hidden="true"> Back</i></a>'),
                  
                             
                    ),

            )
        )
Exemplo n.º 13
0
    def __init__(self,  *args, **kwargs):
        super(MileageLogForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
           TabHolder(
                Tab(
                    'Vehicle Inspection Details',
                   
                    Div(
                        'vehicle', 
                        'driver', 
                        'log_date',
                        'start_date', 
                        'end_date',
                        'status',                        
                        css_class = "col-md-6"),
                    Div(
                        'starting_mileage', 
                        'current_mileage', 
                        'mileage', 
                        'fuel_balance_bf',
                        'fuel_used',
                        'fuel_balance',

                        css_class = "col-md-6"),
                     HTML('<a  href="#inspection-check-list" data-toggle="tab" onclick="newTabToggle()" aria-expanded="true">Next Tab <i class="fa fa-forward" aria-hidden="true"></i></a>'),
                   
                   
                    ),
                Tab(
                    'Inspection Check List',
                  
                        Div(
                            'doors',
                            'seats',
                            'body',
                            'tires',
                            'interior',                         
                            
                            css_class = "col-md-4"),
                        Div(
                            'boot',
                            'under_hood',
                            'engine_check',
                            'exhaust_check',
                            'feature_check',
                           
                            css_class = "col-md-4"),
                        Div(
                            'sound_system',
                            'steering',
                            'brakes',
                            'transmission',
                            'overall_feel',
                            css_class = "col-md-4"),                                            
                           
                            HTML('<a href="#vehicle-inspection-details" data-toggle="tab" aria-expanded="true" onclick="newTabToggle()"><i class="fa fa-backward" aria-hidden="true"></i><span>  Back</span></a>'),
                   
                    )
                )
            )
Exemplo n.º 14
0
    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request', None)
        self.object = kwargs.pop('object', None)

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

        self.fields['num_historia'] = forms.CharField(
            label=capfirst(_(u'num_historia')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['created_ath'] = forms.CharField(
            label=capfirst(_(u'created_ath')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['usuario'] = forms.CharField(
            label=capfirst(_(u'usuario')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['nombre'] = forms.CharField(
            label=capfirst(_(u'nombre')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['duenho'] = forms.ChoiceField(
            label=capfirst(_(u'duenho')),
            required=True,
            # widget=forms.RadioSelect(),
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['direccion'] = forms.CharField(
            label=capfirst(_(u'direccion')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['direccion'] = forms.CharField(
            label=capfirst(_(u'direccion')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['direccion'] = forms.CharField(
            label=capfirst(_(u'direccion')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['ciudad'] = forms.CharField(
            label=capfirst(_(u'ciudad')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['telefono'] = forms.CharField(
            label=capfirst(_(u'telefono')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['edad'] = forms.CharField(
            label=capfirst(_(u'edad')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )

        self.fields['genero'] = forms.CharField(
            label=capfirst(_(u'genero')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['especie'] = forms.CharField(
            label=capfirst(_(u'especie')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['raza'] = forms.CharField(
            label=capfirst(_(u'raza')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )

        self.fields['color'] = forms.CharField(
            label=capfirst(_(u'color')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['actividad'] = forms.CharField(
            label=capfirst(_(u'actividad')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['alimentacion'] = forms.CharField(
            label=capfirst(_(u'alimentacion')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.helper = FormHelper()
        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    _('Informacion del Dueño'),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.duenho.label }} </label>
                                <div class="controls ">{{ form.duenho.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.direccion.label }} </label>
                                <div class="controls ">{{ form.direccion.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.ciudad.label }} </label>
                                <div class="controls ">{{ form.ciudad.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.telefono.label }} </label>
                                <div class="controls ">{{ form.telefono.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                ),
                Tab(
                    _('Informacion Mascota'),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.nombre.label }} </label>
                                <div class="controls ">{{ form.nombre.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.edad.label }} </label>
                                <div class="controls ">{{ form.edad.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.genero.label }} </label>
                                <div class="controls ">{{ form.genero.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.especie.label }} </label>
                                <div class="controls ">{{ form.especie.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.raza.label }} </label>
                                <div class="controls ">{{ form.raza.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.color.label }} </label>
                                <div class="controls ">{{ form.color.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                ),
                Tab(
                    _('Historial'),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.num_historia.label }} </label>
                                <div class="controls ">{{ form.num_historia.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.created_ath.label }} </label>
                                <div class="controls ">{{ form.created_ath.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(HTML('''
                                <div class="form-group">
                                <label class="control-label"> {{ form.usuario.label }} </label>
                                <div class="controls ">{{ form.usuario.value }}</div>
                                </div>
                                '''),
                            css_class='col-md-6'), ),
                ),
            ),
            Row(FormActions(btnCancel(), ), ),
        )
Exemplo n.º 15
0
    def __init__(self, *args, **kwargs):
        super(SearchOpeningForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        # self.helper.form_id = 'test'
        self.helper.form_method = 'get'
        # self.helper.form_action = reverse('Home')
        # self.helper.add_input(Submit('submit', value='Refresh', css_class='btn-block btn-success'))
        # self.helper.add_input(Reset('name', 'Reset')) #implement this when jquery is up and remove submit
        # self.helper.form_class = 'form-horizontal'
        # self.helper.form_class = 'search'

        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    'Subject/Level',
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><h4><label>Select Subject</label></h4></div>"""
                    ),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><span><p><b>Languages</b></p></span></div>"""
                    ),
                    Div(InlineRadios('subject_1'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><span><p><b>Math & Sciences</b></p></span></div>"""
                    ),
                    Div(InlineRadios('subject_2'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><span><p><b>Arts, Humanities & Others</b></p></span></div>"""
                    ),
                    Div(InlineRadios('subject_3'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><h4><label>Select Level</label></h4></div>"""
                    ),
                    Div(InlineRadios('level_grp'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),

                    # Div(InlineRadios('subject'), css_class='col-xs-12 col-md-12 col-lg-12'),
                    # Div(InlineRadios('level'), css_class='col-xs-12 col-md-12 col-lg-12'),
                ),
                Tab(
                    'Your Preferred Regions',
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><h4><label>Region</label></h4></div>"""
                    ),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><span><p><b>Central locations</b></p></span></div>"""
                    ),
                    Div(InlineCheckboxes('region_1'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><span><p><b>North locations</b></p></span></div>"""
                    ),
                    Div(InlineCheckboxes('region_2'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><span><p><b>East locations</b></p></span></div>"""
                    ),
                    Div(InlineCheckboxes('region_3'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),
                    HTML(
                        """<div class="col-xs-12 col-md-12 col-lg-12"><span><p><b>West locations</b></p></span></div>"""
                    ),
                    Div(InlineCheckboxes('region_4'),
                        css_class='col-xs-12 col-md-12 col-lg-12'),

                    # Div(InlineCheckboxes('region'), css_class='col-xs-12 col-md-12 col-lg-12'),
                ),
                # Tab('Salary',
                # 	Div(Field('minimum_pay'), css_class='col-xs-12 col-md-3 col-lg-3'),
                # ),
                # Tab('Keyword Description Search',
                # 	Div(Field('search'), css_class='col-xs-12 col-md-6 col-lg-6'),
                # ),
                Tab(
                    'Other Details',
                    HTML(
                        """<div class="col-xs-12 col-md-12"><h4><label>Other Details</label></h4></div>"""
                    ),
                    Div(Field('minimum_pay'), css_class='col-xs-6 col-md-4'),
                    Div(Field('search'), css_class='col-xs-6 col-md-4'),

                    # Div(Field('minimum_years'), css_class='col-xs-12 col-md-6 col-lg-6'),
                    # Div(Field('maximum_pay'), css_class='col-xs-12 col-md-6 col-lg-6'),

                    # Div(Field('search'), css_class='col-xs-12 col-md-6 col-lg-6'),
                    # HTML("""<div class="col-xs-6 col-md-4"><br></div>"""),
                    Div(Field('group_tuition'), css_class='col-xs-6 col-md-4'),
                ),
            ),
            ButtonHolder(
                Submit('submit',
                       'Refresh',
                       css_class='col-xs-4 col-xs-offset-1'),
                HTML(
                    '<a class="btn btn-default col-xs-4 col-xs-offset-1" href="{% url "OpeningList" %}">Reset</a>'
                ),
            ),
        )
Exemplo n.º 16
0
    def __init__(self, *args, **kwargs):
        super(RegistrationEnterpriseAssociationForm,
              self).__init__(*args, **kwargs)
        self.fields['name'] = forms.CharField(
            label=capfirst(_(u'Enterprise')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['association_name'] = forms.CharField(
            label=capfirst(_(u'Association')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )

        self.fields['acept'] = forms.BooleanField(
            label=capfirst(
                _(u'I accept the Terms of Service and Privacy Policy.')),
            required=True,
            # widget=forms.CheckboxInput(),
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['logo'] = forms.ImageField(
            label=capfirst(_(u'logo')),
            required=False,
            initial='enterprises/default.png',
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Available formats are JPG, GIF, and PNG.'),
        )
        self.fields['solution'].required = True
        self.fields[
            'solution'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        self.fields[
            'type_e'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        self.fields[
            'tax_id'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')

        self.helper = FormHelper()
        self.helper.form_id = 'form'
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    _('Enterprise'),
                    Row(
                        Div(Field('name',
                                  autofocus=True,
                                  css_class='input-required'),
                            css_class='col-md-6'),
                        Div(Field(
                            'tax_id',
                            css_class='input-required',
                        ),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(Field(
                            'association_name',
                            css_class='input-required',
                        ),
                            css_class='col-md-6'),
                        Div(Field(
                            'type_e',
                            css_class='input-required',
                        ),
                            css_class='col-md-6'),
                    ),
                    Row(
                        Div(Field(
                            'solution',
                            css_class='input-required',
                        ),
                            css_class='col-md-6'), ),
                ),
                Tab(_('Image'), Field('logo', css_class="")),
            ),
            Row(
                Div(Field(
                    'acept',
                    css_class='input-required',
                ),
                    css_class='col-md-12'), ),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )
Exemplo n.º 17
0
    def __init__(self, *args, **kwargs):
        request = kwargs.pop('request', None)
        super(WidgetUpdateForm, self).__init__(*args, **kwargs)

        if request:
            queryset = self.fields['content_theme'].queryset

            self.fields['content_theme'].queryset = \
                queryset.filter(widget_class=self._meta.model.__name__)
        else:
            # set defaults
            self.init_themes()
            del self.fields['id']

        # get all fields for widget
        main_fields = self._meta.model.fields()
        main_fields.update({'label': 'label'})
        self.helper.layout = Layout(
            TabHolder(
                Tab(self._meta.model._meta.verbose_name.capitalize(),
                    *main_fields,
                    css_id='field-{}'.format(slugify(self._meta.model))),
                Tab(_('Theme'),
                    'base_theme',
                    'content_theme',
                    'color_scheme',
                    Fieldset(_('Positions'), 'layout', 'align',
                             'vertical_align'),
                    'id',
                    'region',
                    'ordering',
                    'parent',
                    css_id='theme-widget-settings'),
                Tab(_('Effects'),
                    'enter_effect_style',
                    'enter_effect_duration',
                    'enter_effect_delay',
                    'enter_effect_offset',
                    'enter_effect_iteration',
                    css_id='theme-widget-effects'),
            ))

        self.fields['label'].widget = \
            forms.TextInput(
                attrs={'placeholder': self._meta.model._meta.verbose_name})

        if request:
            from .tables import WidgetDimensionTable
            _request = copy.copy(request)
            _request.POST = {}
            _request.method = 'GET'
            initial = kwargs.get('initial', None)
            if initial and initial.get('id', None):
                widget = self._meta.model.objects.get(id=initial['id'])
                data = widget.dimensions
            else:
                data = []
                widget = None
            dimensions = Tab(
                _('Dimensions'),
                HTML(
                    WidgetDimensionTable(_request, widget=widget,
                                         data=data).render()),
            )
            self.helper.layout[0].append(dimensions)

        # hide label
        if 'text' in self.fields:
            self.fields['text'].label = ''
Exemplo n.º 18
0
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-4'
        self.helper.field_class = 'col-lg-7'
        #self.helper.error_text_inline = False

        self.helper.layout = Layout(
            TabHolder(
                Tab(
                    'General', *[
                        Div(field_name) for field_name in [
                            'invite_code',
                            'rules',
                            'bot_prefix',
                            'bot_discret',
                            'force_justification_level',
                            'logs_security_level',
                        ]
                    ]),
                Tab(
                    'Automod',
                    TabHolder(
                        Tab(
                            'Required totals to act', *[
                                Div(field_name) for field_name in [
                                    'automod_enable',
                                    'automod_delete_message_score',
                                    'automod_warn_score',
                                    'automod_kick_score',
                                    'automod_softban_score',
                                    'automod_ban_score',
                                ]
                            ]),
                        Tab(
                            'Users multiplicators', *[
                                Div(field_name) for field_name in [
                                    'automod_multiplictor_offline',
                                    'automod_multiplictor_new_account',
                                    'automod_multiplictor_just_joined',
                                    'automod_multiplictor_have_nitro',
                                    'automod_multiplictor_have_roles',
                                    'automod_multiplictor_bot_banned',
                                ]
                            ]),
                        Tab(
                            'Messages scores', *[
                                Div(field_name) for field_name in [
                                    'automod_score_caps',
                                    'automod_score_embed',
                                    'automod_score_everyone',
                                    'automod_score_too_many_mentions',
                                    'automod_score_multimessage_too_many_mentions',
                                    'automod_score_multimessage_too_many_users_mentions',
                                    'automod_score_contain_invites',
                                    'automod_score_repeated',
                                    'automod_score_bad_words',
                                    'automod_score_zalgo',
                                ]
                            ]),
                        Tab(
                            'AutoTrigger',
                            HTML(
                                """</br><div class="alert alert-info" role="alert">
                                      AutoTriggers fire for specific configured messages.</br>
                                      If you find bots spamming in a number of discord servers that aren't well caught by the AutoMod, 
                                      feel free to suggest an AutoTrigger on the support server. </br>
                                      You can disable any of them by setting their score to 0.
                                    </div>
                                """),
                            *[
                                Div(field_name) for field_name in [
                                    'autotrigger_enable',
                                    'autotrigger_badstrings_score',
                                    'autotrigger_sexdatingdiscordbots_score',
                                    'autotrigger_instantessaydiscordbots_score',
                                    'autotrigger_sexbots_score',
                                    'autotrigger_libradiscordbots_score',
                                ]
                            ]),
                        Tab(
                            'Misc options', *[
                                Div(field_name) for field_name in [
                                    'automod_ignore_level',
                                    'automod_minimal_membercount_trust_server',
                                    'automod_note_message_deletions',
                                ]
                            ]),
                    ),
                ),
                Tab(
                    'AutoInspect',
                    HTML("""</br><div class="alert alert-info" role="alert">
                                        AutoInspect inspect people profiles for pre-configured patterns and then act on them. This feature is experimental. 
                                        Please go to the support server if you have any questions.</br>

                                        ⚠️ Activating this can kick/ban people when they join, thus limiting their ability to warn you of a misconfiguration.
                                         For this reason, you <strong>MUST</strong> have a configured log channel (AutoInspect logs)
                                      </div>
                                    """), *[
                        Div(field_name) for field_name in [
                            'autoinspect_enable',
                            'autoinspect_bypass_enable',
                            'autoinspect_bitcoin_bots',
                            'autoinspect_pornspam_bots',
                            'autoinspect_username',
                            'autoinspect_suspicious',
                            'autoinspect_antiraid',
                        ]
                    ]),
                Tab(
                    'DeHoister', *[
                        Div(field_name) for field_name in [
                            'dehoist_enable',
                            'dehoist_ignore_level',
                            'dehoist_intensity',
                            'dehoist_action',
                        ]
                    ]),
                Tab(
                    'Thresholds', *[
                        Div(field_name) for field_name in [
                            'thresholds_enable',
                            'thresholds_mutes_to_kick',
                            'thresholds_warns_to_kick',
                            'thresholds_kicks_to_bans',
                            'thresholds_softbans_to_bans',
                        ]
                    ]),
                Tab(
                    'Permissions', *[
                        Div(field_name) for field_name in [
                            'permissions_admins',
                            'permissions_moderators',
                            'permissions_trusted',
                            'permissions_banned',
                        ]
                    ]),
                Tab(
                    'Logs', *[
                        Div(field_name) for field_name in [
                            'logs_enable',
                            'logs_as_embed',
                            'logs_moderation_channel_id',
                            'logs_joins_channel_id',
                            'logs_rolepersist_channel_id',
                            'logs_member_edits_channel_id',
                            'logs_edits_channel_id',
                            'logs_delete_channel_id',
                            'logs_autoinspect_channel_id',
                        ]
                    ]),
                Tab(
                    'VIP Settings',
                    HTML("""</br><div class="alert alert-info" role="alert">
                    The settings you can see on this tab are only available to VIP servers. You can edit them, but you'll need a VIP server for them to work.<br/>
                    For more information about VIP servers, please see the <a href='https://docs.getbeaned.me/bot-documentation/vip-servers'>following documentation</a>
                    </div>"""),
                    *[
                        Div(field_name) for field_name in [
                            'rolepersist_enable',
                            'rolepersist_default_roles',
                            'vip_custom_bad_words_list',
                            'vip_custom_bad_regex_list',
                        ]
                    ],
                    HTML("""</br><div class="alert alert-warning" role="alert">
                            Please test your regexes before submitting the form! Use <a href='https://regex101.com/'>Regex101</a> 
                            to make sure they match what you want, nothing more and nothing less.
                            </div>"""),
                ),
            ))
        self.helper.add_input(Submit('submit', 'Submit'))
        super(WebSettingsForm, self).__init__(*args, **kwargs)
Exemplo n.º 19
0
 def __init__(self, *args, **kwargs):
     super(ComponentSettingsForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_tag = False
     self.helper.layout = Layout(
         TabHolder(
             Tab(
                 _('Basic'),
                 Fieldset(
                     _('License'),
                     'license',
                     'license_url',
                     'agreement',
                 ),
                 Fieldset(
                     _('Upstream links'),
                     'report_source_bugs',
                 ),
                 css_id='basic',
             ),
             Tab(
                 _('Translation'),
                 Fieldset(
                     _('Suggestions'),
                     'enable_suggestions',
                     'suggestion_voting',
                     'suggestion_autoaccept',
                 ),
                 Fieldset(
                     _('Translation settings'),
                     'allow_translation_propagation',
                     'save_history',
                     'check_flags',
                 ),
                 css_id='translation',
             ),
             Tab(
                 _('Version control'),
                 Fieldset(
                     _('Locations'),
                     'repoweb',
                 ),
                 Fieldset(
                     _('Version control settings'),
                     'push_on_commit',
                     'commit_pending_age',
                     'merge_style',
                 ),
                 Fieldset(
                     _('Commit messages'),
                     'commit_message',
                     'add_message',
                     'delete_message',
                 ),
                 css_id='vcs',
             ),
             Tab(
                 _('Files'),
                 Fieldset(
                     _('Languages processing'),
                     'filemask',
                     'language_regex',
                     'template',
                     'edit_template',
                     'new_base',
                     'new_lang',
                 ),
                 css_id='files',
             ),
             template='layout/pills.html',
         )
     )
Exemplo n.º 20
0
    def __init__(self, *args, **kwargs):
        super(addDatafor_core, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Div(TabHolder(
                Tab(u'1. Цели и задачи', Div('aim', 'tasks')),
                Tab(
                    u'2. Содержание дисциплины',
                    TabHolder(
                        Tab(u'2.1 Содержание разделов и тем дисциплины',
                            Div(css_id='tablecontentOfSections'),
                            Div('contentOfSections')),
                        Tab(
                            u'2.2 Междициплинарные связи с последующими дисциплинами',
                            Div(css_id='tableinterdiscipRelations'),
                            Div('interdiscipRelations')),
                        Tab(
                            u'2.3 Разделы (модули), темы дисциплин виды занятий',
                            Div(css_id='tablesectionshour',
                                css_class='col-md-auto'),
                            Div('table_sections_hour'),
                            Div(
                                Button('button_calc',
                                       'Рассчитать часы',
                                       css_class='btn btn-success',
                                       css_id='button_fill_hour_sections'))),
                        Tab(
                            u'2.4 Перечень лекционных занятий',
                            Div(css_id='tablelectureshour',
                                css_class='col-md-auto'),
                            Div('table_lectures_hour'),
                            Div(
                                Button('button_calc',
                                       'Рассчитать часы',
                                       css_class='btn btn-success',
                                       css_id='button_fill_hour_lec'))),
                        Tab(
                            u'2.8 Перечень тем самостоятельной работы',
                            Div(css_id='tablesamosthour',
                                css_class='col-md-auto'),
                            Div('table_samost_hour'),
                            Div(
                                Button('button_calc',
                                       'Рассчитать часы',
                                       css_class='btn btn-success',
                                       css_id='button_fill_hour_samost'))),
                        Tab(
                            u'2.9 Примерная тематика курсовых проектов (работ)',
                            Div('theme_kursovih_rabot')),
                        Tab(u'2.10 Лицензионное программное обеспечение',
                            Div('software_lic')),
                    )),
                Tab(u'3 Материально-техническое обеспечение дисциплины',
                    Div('material_teh_obespech_dicip')),
                Tab(
                    u'4 Базы данных, информационно-справочные и поисковые системы',
                    Div('database_info_system'))),
                css_id='tabslist'),
            FormActions(
                Submit('next',
                       u'Сохранить',
                       css_class="btn-primary",
                       css_id='btn_save_data_umk'), Submit('cancel',
                                                           u'Назад')))

        self.fields['aim'].widget = TinyMCE(attrs={'cols': 80, 'rows': 30})
        self.fields['tasks'].widget = TinyMCE(attrs={'cols': 80, 'rows': 30})
        self.fields['contentOfSections'].widget = forms.HiddenInput()
        self.fields['interdiscipRelations'].widget = forms.HiddenInput()
        self.fields['table_sections_hour'].widget = forms.HiddenInput()
        self.fields['table_lectures_hour'].widget = forms.HiddenInput()
        self.fields['table_samost_hour'].widget = forms.HiddenInput()
        self.fields['material_teh_obespech_dicip'].widget = TinyMCE(attrs={
            'cols': 80,
            'rows': 30
        })
        self.fields['database_info_system'].widget = TinyMCE(attrs={
            'cols': 80,
            'rows': 30
        })
        self.fields['software_lic'].widget = TinyMCE(attrs={
            'cols': 80,
            'rows': 30
        })