当前位置: 首页>>代码示例>>Python>>正文


Python layout.HTML属性代码示例

本文整理汇总了Python中crispy_forms.layout.HTML属性的典型用法代码示例。如果您正苦于以下问题:Python layout.HTML属性的具体用法?Python layout.HTML怎么用?Python layout.HTML使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在crispy_forms.layout的用法示例。


在下文中一共展示了layout.HTML属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, *args, **kwargs):
        AuthenticationForm.__init__(self, *args, **kwargs)
        self.error_messages['invalid_login'] = _(u"Пожалуйста, введите верные имя пользователя / адрес электронной почты  и пароль.")
        self.fields['username'].label = _(u"Логин / E-mail")

        self.helper = FormHelper(self)
        self.helper.form_action = '/accounts/login/'
        self.helper.label_class = 'col-md-4'
        self.helper.field_class = 'col-md-8'
        self.helper.layout.append(HTML(u"""<div class="form-group row" style="margin-bottom: 16px;margin-top: -16px;">
                                             <div class="col-md-offset-4 col-md-8">
                                               <a href="{% url "django.contrib.auth.views.password_reset" %}"><small class="text-muted">""" + _(u'Забыли пароль?') + """</small></a>
                                             </div>
                                           </div>
                                           <div class="form-group row">
                                             <div class="col-md-offset-4 col-md-8">
                                               <button type="submit" class="btn btn-secondary">""" + _(u'Войти') + """</button>
                                               <input type="hidden" name="next" value="{{ next }}" />
                                             </div>
                                           </div>""")) 
开发者ID:znick,项目名称:anytask,代码行数:22,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, *args, **kwargs):
        PasswordResetForm.__init__(self, *args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.label_class = 'col-md-5'
        self.helper.field_class = 'col-md-7'
        self.helper.layout.append(HTML(u"""<div class="form-group row">
                                             <div class="col-md-offset-5 col-md-7">
                                               <button type="submit" class="btn btn-secondary">""" + _(u'Сбросить') + """</button>
                                             </div>
                                           </div>""")) 
开发者ID:znick,项目名称:anytask,代码行数:12,代码来源:__init__.py

示例3: unit_selector_html

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def unit_selector_html(unit_name, options):
    """Format the units HTML for AppendedText"""

    s = ''

    for option in options:
        s += '''<label for="{name}_units">{option}</label>
                <input name="{name}_units"
                       type="radio" value="{option}">'''.format(
            name=unit_name, option=option)

    return s 
开发者ID:SaturdayNeighborhoodHealthClinic,项目名称:osler,代码行数:14,代码来源:forms.py

示例4: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, *args, **kwargs):
        super(FolderForm, self).__init__(*args, **kwargs)

        files_area = ''

        if 'id' in kwargs.get('initial'):

            folder = Folder.objects.get(id=kwargs['initial']['id'])
            files_area = render_to_string(
                'admin/media/folder/directory_table_modal.html',
                {'files': folder.files.all()})

        self.fields['files'].widget.attrs["webkitdirectory"] = ""
        self.fields['files'].widget.attrs["directory"] = ""
        self.fields['files'].widget.attrs["mozdirectory="""] = ""

        self.helper.layout = Layout(
            TabHolder(
                Tab(_('Folder'),
                    'id', 'folder', 'name', 'parent',
                    ),
                Tab(_('Files'),
                    Div(Field('file'),
                        css_class="col-lg-6 field-wrapper"),
                    Div(Field('files'),
                        css_class="col-lg-6 field-wrapper"),
                    HTML('''
                        <a href="#" id="add-another" class="btn fa fa-plus">Add</a>
                        <script>
                        $(function() {
                            $('#add-another').click(function() {
                                var cloned = $("#id_file").clone();
                                cloned.val(null);
                                $(cloned).insertAfter("#id_file");
                             });
                            });
                        </script>
                        '''), HTML(files_area)
                    ),
            )
        ) 
开发者ID:django-leonardo,项目名称:django-leonardo,代码行数:43,代码来源:forms.py

示例5: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, *args, **kwargs):
        super(BridgeCreateForm, self).__init__(*args, **kwargs)
        helper = self.helper = FormHelper()

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

        helper.form_show_labels = False
        helper.form_class = 'form-horizontal'
        helper.field_class = 'col-lg-8'
        helper.help_text_inline = True 
开发者ID:Lujeni,项目名称:matterllo,代码行数:16,代码来源:forms.py

示例6: _add_user_data_subform

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def _add_user_data_subform(self, user_data):
        self._validate_user_data(user_data)

        if user_data:
            # Translators: This labels a section of a form where we ask users to enter personal information (such as their country of residence) when making an application.
            user_data_layout = Fieldset(_("About you"))
            for datum in user_data:
                self.fields[datum] = FIELD_TYPES[datum]
                self.fields[datum].label = FIELD_LABELS[datum]
                # Show which partner wants which personal data if applying
                # for more than one.
                if len(self.field_params) > 1:
                    # fmt: off
                    # Translators: This text is shown in the application form under each piece of personal information requested. {partner_list} will be a list of 2 or more organisations that require this personal data, and should not be translated.
                    self.fields[datum].help_text = _("Requested by: {partner_list}").format(
                        partner_list=", ".join(user_data[datum])
                    ),
                    # fmt: on
                user_data_layout.append(datum)

            self.helper.layout.append(user_data_layout)
            # fmt: off
            # Translators: This note appears in a section of a form where we ask users to enter info (like country of residence) when applying for resource access.
            disclaimer_html = _("<p><small><i>Your personal data will be processed according to our <a href='{terms_url}'> privacy policy</a>.</i></small></p>").format(
                terms_url=reverse("terms")
            )
            # fmt: on
            self.helper.layout.append(HTML(disclaimer_html)) 
开发者ID:WikipediaLibrary,项目名称:TWLight,代码行数:30,代码来源:forms.py

示例7: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, *args, **kwargs):
        super(TaskPairCauseOptionsForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.label_class = 'col-md-2'
        self.helper.field_class = 'col-md-8'
        fields = ['cause_agent', 'cause_task']

        predefined_fields = {}
        for key in ['cause_agent', 'cause_task']:
            if key in kwargs.get('initial', {}):
                predefined_fields[key] = kwargs['initial'][key]
            elif 'prefix' in kwargs and '{}-{}'.format(kwargs['prefix'], key) in self.data:
                predefined_fields[key] = self.data['{}-{}'.format(kwargs['prefix'], key)]
            elif key in self.data:
                predefined_fields[key] = self.data[key]

        if set(['cause_agent', 'cause_task']) <= set(predefined_fields):
            task = Agent.registry[predefined_fields['cause_agent']]\
                .cause_tasks[predefined_fields['cause_task']]
            if getattr(task, 'help', False):
                fields.append(HTML("""
                                <div class="alert alert-info" role="alert">
                                {help}
                                </div>
                                """.format(help=task.help)))
            for option, field in getattr(task, 'options', {}).items():
                self.fields['cause-opt-'+option] = field
                fields.append('cause-opt-'+option)
            if not getattr(task, 'options', False):
                fields.append(HTML("""
                                <div class="alert alert-success" role="alert">
                                No options to complete
                                </div>
                                """))
        fields.append(FormActions(Submit('submit', 'Continue')))
        self.helper.layout = Layout(Fieldset('Task Options', *fields)) 
开发者ID:dschep,项目名称:HELPeR,代码行数:38,代码来源:forms.py

示例8: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)

        title_field = layout.Field("title", css_class="input-block-level")
        content_field = layout.Field("content", css_class="input-block-level", rows="3")
        main_fieldset = layout.Fieldset(_("Main data"), title_field, content_field)

        picture_field = layout.Field("picture", css_class="input-block-level")
        format_html = layout.HTML(
            """{% include "ideas/includes/picture_guidelines.html" %}"""
        )

        picture_fieldset = layout.Fieldset(
            _("Picture"),
            picture_field,
            format_html,
            title=_("Image upload"),
            css_id="picture_fieldset",
        )

        inline_translations = layout.HTML(
            """{% include "ideas/forms/translations.html" %}"""
        )

        submit_button = layout.Submit("save", _("Save"))
        actions = bootstrap.FormActions(submit_button)

        self.helper = helper.FormHelper()
        self.helper.form_action = self.request.path
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(
            main_fieldset,
            inline_translations,
            picture_fieldset,
            actions,
        ) 
开发者ID:PacktPublishing,项目名称:Django-3-Web-Development-Cookbook-Fourth-Edition,代码行数:39,代码来源:forms.py

示例9: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)

        self.fields["categories"].widget = forms.CheckboxSelectMultiple()

        title_field = layout.Field("title")
        content_field = layout.Field("content", rows="3")
        main_fieldset = layout.Fieldset(_("Main data"), title_field, content_field)

        picture_field = layout.Field("picture")
        format_html = layout.HTML(
            """{% include "ideas2/includes/picture_guidelines.html" %}"""
        )

        picture_fieldset = layout.Fieldset(
            _("Picture"),
            picture_field,
            format_html,
            title=_("Image upload"),
            css_id="picture_fieldset",
        )

        categories_field = layout.Field("categories")
        categories_fieldset = layout.Fieldset(
            _("Categories"), categories_field, css_id="categories_fieldset"
        )

        submit_button = layout.Submit("save", _("Save"))
        actions = bootstrap.FormActions(submit_button)

        self.helper = helper.FormHelper()
        self.helper.form_action = self.request.path
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(
            main_fieldset,
            picture_fieldset,
            categories_fieldset,
            actions,
        ) 
开发者ID:PacktPublishing,项目名称:Django-3-Web-Development-Cookbook-Fourth-Edition,代码行数:42,代码来源:forms.py

示例10: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)

        title_field = layout.Field("title")
        content_field = layout.Field("content", rows="3")
        main_fieldset = layout.Fieldset(_("Main data"), title_field, content_field)

        picture_field = layout.Field("picture")
        format_html = layout.HTML(
            """{% include "ideas1/includes/picture_guidelines.html" %}"""
        )

        picture_fieldset = layout.Fieldset(
            _("Picture"),
            picture_field,
            format_html,
            title=_("Image upload"),
            css_id="picture_fieldset",
        )

        categories_field = layout.Field(
            "categories",
            template="core/includes/checkboxselectmultiple_tree.html"
        )
        categories_fieldset = layout.Fieldset(
            _("Categories"), categories_field, css_id="categories_fieldset"
        )

        submit_button = layout.Submit("save", _("Save"))
        actions = bootstrap.FormActions(submit_button, css_class="my-4")

        self.helper = helper.FormHelper()
        self.helper.form_action = self.request.path
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(
            main_fieldset,
            picture_fieldset,
            categories_fieldset,
            actions,
        ) 
开发者ID:PacktPublishing,项目名称:Django-3-Web-Development-Cookbook-Fourth-Edition,代码行数:43,代码来源:forms.py

示例11: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import HTML [as 别名]
def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)

        self.fields["categories"].widget = forms.CheckboxSelectMultiple()

        title_field = layout.Field("title", css_class="input-block-level")
        content_field = layout.Field("content", css_class="input-block-level", rows="3")
        main_fieldset = layout.Fieldset(_("Main data"), title_field, content_field)

        picture_field = layout.Field("picture", css_class="input-block-level")
        format_html = layout.HTML(
            """{% include "ideas/includes/picture_guidelines.html" %}"""
        )

        picture_fieldset = layout.Fieldset(
            _("Picture"),
            picture_field,
            format_html,
            title=_("Image upload"),
            css_id="picture_fieldset",
        )

        categories_field = layout.Field("categories", css_class="input-block-level")
        categories_fieldset = layout.Fieldset(
            _("Categories"), categories_field, css_id="categories_fieldset"
        )

        inline_translations = layout.HTML(
            """{% include "ideas/forms/translations.html" %}"""
        )

        submit_button = layout.Submit("save", _("Save"))
        actions = bootstrap.FormActions(submit_button)

        self.helper = helper.FormHelper()
        self.helper.form_action = self.request.path
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(
            main_fieldset,
            inline_translations,
            picture_fieldset,
            categories_fieldset,
            actions,
        ) 
开发者ID:PacktPublishing,项目名称:Django-3-Web-Development-Cookbook-Fourth-Edition,代码行数:47,代码来源:forms.py


注:本文中的crispy_forms.layout.HTML属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。