Python crispy_forms.layout 模块,Field() 实例源码

我们从Python开源项目中,提取了以下39个代码示例,用于说明如何使用crispy_forms.layout.Field()

项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SubVacuumForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'inactive-subscribers-form'
        self.helper.form_method = 'post'
        self.helper.form_action = '/dashboard/network/inactive-subscribers'
        # Render the inactive_days field differently depending on whether or
        # not this feature is active.
        if args[0]['sub_vacuum_enabled']:
            days_field = Field('inactive_days')
        else:
            days_field = Field('inactive_days', disabled=True)
        self.helper.layout = Layout(
            'sub_vacuum_enabled',
            days_field,
            Submit('submit', 'Save', css_class='pull-right'),
        )
项目:Django-Web-Development-with-Python    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(BulletinFilterForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "GET"

        self.helper.layout = layout.Layout(
            layout.Fieldset(
                _("Filter bulletins"),
                layout.Field("bulletin_type"),
                layout.Field("category"),
            ),
            bootstrap.FormActions(
                layout.Submit("submit", _("Filter")),
            ),
        )
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SponsorContactForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("responded"),
            Field("companyName"),
            Field("contactEMail"),
            HTML("<p class=\"text-info\">Please ensure the correctness of the address. It will later be used in the billing process.</p>"),
            Field("street"),
            Field("zipcode"),
            Field("city"),
            Field("country"),
            Field("contactPersonFirstname"),
            Field("contactPersonSurname"),
            Field("contactPersonGender"),
            Field("contactPersonEmail"),
            Field("contactPersonLanguage"),
            Field("template"),
            Field("comment")
        )
        self.helper.add_input(Submit("Save", "Save"))
项目:waves-demo    作者:lirmm    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SignupForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.fields["email"].widget.input_type = "email"  # ugly hack
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-md-4 col-xs-4 hidden-sm hidden-xs'
        self.helper.field_class = 'col-md-8 col-xs-12'
        # self.helper.form_show_labels = False
        if 'bootstrap' in settings.CRISPY_TEMPLATE_PACK:
            email_field = PrependedText('email', '@', placeholder="Enter Email", autofocus="")
        else:
            email_field = Field('email', placeholder="Enter Email", autofocus="")
        self.helper.layout = Layout(
            email_field,
            Field('name', placeholder="Enter your full name"),
            Field('password1', placeholder="Enter Password"),
            Field('password2', placeholder="Confirm Password"),
            Field('register_for_api', placeholder="Register for our API access"),
            Field('country', placeholder="Select your country"),
            Field('institution', placeholder="Your institution"),
            Field('phone', placeholder="Phone"),
            Field('comment', placeholder="Any comment ?"),
            Field('tos', ),
            Submit('sign_up', 'Sign up', css_class="btn btn-lg btn-primary btn-block"),
        )
项目:blog_django    作者:chnpmy    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:dream_blog    作者:fanlion    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:MxOnline    作者:myTeemo    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:djangoblog    作者:liuhuipy    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:sdining    作者:Lurance    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(NetworkSettingsForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'network-settings-form'
        self.helper.form_method = 'post'
        self.helper.form_action = '/dashboard/network/edit'
        # Render the autoupgrade field channel and window fields differently
        # depending on the state of autoupgrade_enabled.
        if args[0]['autoupgrade_enabled']:
            channel_field = Field('autoupgrade_channel')
            in_window_field = Field('autoupgrade_in_window')
            # Render the window-time selection field differently depending on
            # the value of autoupgrade_in_window.
            if args[0]['autoupgrade_in_window']:
                window_field = Field('autoupgrade_window_start')
            else:
                window_field = Field('autoupgrade_window_start', disabled=True)
        else:
            channel_field = Field('autoupgrade_channel', disabled=True)
            in_window_field = Field('autoupgrade_in_window', disabled=True)
            window_field = Field('autoupgrade_window_start', disabled=True)
        self.helper.layout = Layout(
            'network_name',
            'subscriber_currency',
            'number_country',
            'autoupgrade_enabled',
            channel_field,
            in_window_field,
            window_field,
            Submit('submit', 'Save', css_class='pull-right'),
        )
项目:Django-Web-Development-with-Python    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(InspirationQuoteForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            layout.Fieldset(
                _("Quote"),
                layout.Field("author"),
                layout.Field("quote", rows=3),
                layout.HTML("""
                {% include "quotes/includes/image_upload_widget.html" %}
                """),
                layout.Field("picture_path"),  # hidden
                layout.Field("delete_picture"),  # hidden
            ),
            bootstrap.FormActions(
                layout.Submit("submit", _("Save"), css_class="btn btn-primary"),
            )
        )
项目:Django-Web-Development-with-Python    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(MovieForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            layout.Field("title"),
            layout.Field("categories", template="utils/checkbox_select_multiple_tree.html"),
            bootstrap.FormActions(
                layout.Submit("submit", _("Save")),
            )
        )
项目:Django-Web-Development-with-Python    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(MovieForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            layout.Field("title"),
            layout.Field("categories", template="utils/checkbox_select_multiple_tree.html"),
            bootstrap.FormActions(
                layout.Submit("submit", _("Save")),
            )
        )
项目:xadmin-markdown-editor    作者:bluenknight    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(DevroomGeneralForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        if self.instance and self.instance.logo:
            self.helper.layout = Layout(
                Field("projectName"),
                Field("logo"),
                Div(
                    HTML("<p>Current logo:</p><img src=\"{{object.logo.url}}\" style=\"max-height:200px\"/>"),
                    css_class = "control-group"),
                Field("homepage"),
#               FormActions(Submit("Save", "Save changes"))
            )
        else:
            self.helper.layout = Layout(
                Field("projectName"),
                Div(
                    Div(Field("logo"),css_class = "col-md-2"),
                    css_class = "row"
                ),
                Field("homepage"),
#               FormActions(Submit("Save", "{% if object %}Save changes{% else %}Register{% endif %}"))
            )

        if self.instance is not None and self.instance.id is not None:
            self.helper.add_input(Submit("Save", "Save changes"))
        else:
            self.helper.add_input(Submit("Save", "Register"))
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(DevroomDescriptionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("descriptionDE"),
            Field("descriptionEN"),
#           FormActions(Submit("Save", "Save changes"))
        )
        self.helper.add_input(Submit("Save","Save changes"))
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(DevroomProgramForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("schedule"),
            Field("plannedProgram"),
            Field("anticipatedGuests"),
#           FormActions(Submit("Save", "Save changes"))
        )
        self.helper.add_input(Submit("Save","Save changes"))
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(ExhibitorGeneralForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        if self.instance and self.instance.logo:
            self.helper.layout = Layout(
                Field("projectName"),
                Field("logo"),
                Div(
                    HTML("<p>Current logo:</p><img src=\"{{object.logo.url}}\" style=\"max-height:200px\"/>"),
                    css_class = "control-group"),
                Field("homepage"),
#               FormActions(Submit("Save", "Save changes"))
            )
        else:
            self.helper.layout = Layout(
                Field("projectName"),
                Div(
                    Div(Field("logo"),css_class = "col-md-2"),
                    css_class = "row"
                ),
                Field("homepage"),
#               FormActions(Submit("Save", "{% if object %}Save changes{% else %}Register{% endif %}"))
            )

        if self.instance is not None and self.instance.id is not None:
            self.helper.add_input(Submit("Save", "Save changes"))
        else:
            self.helper.add_input(Submit("Save", "Register"))
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(ExhibitorDescriptionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("descriptionDE"),
            Field("descriptionEN"),
#           FormActions(Submit("Save", "Save changes"))
        )
        self.helper.add_input(Submit("Save","Save changes"))
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(PackagesImporterForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-5'
        self.helper.field_class = 'col-lg-5'
        self.helper.layout = Layout(
            Field("fromYear"),
        )
        self.helper.form_action = "sponsorpackage_import"
        self.helper.add_input(Submit("Import", "Import"))
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SponsorCreationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.layout = Layout(
            Field("sponsorUsername"),
            Field("sponsorPackage"),
            Field("internalComment")
        )
        self.helper.add_input(Submit("Save","Create sponsor"))
项目:SaBoT    作者:froscon    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SponsorPackageForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field("name"),
            Field("hpCatagoryName"),
            Field("comments"),
            Field("color"),
            AppendedText("price",u"€"),
            Field("countPackages"),
            Field("logoWebsitePositionEN"),
            Field("logoWebsitePositionDE"),
            Field("hasLogoOnPrintmedia"),
            Field("hasSocialMedia"),
            Field("hasHpText"),
            Field("hasProgramAdText"),
            Field("programAdTextNumWords"),
            Field("hasProgramAd"),
            Div(
                Field("programAdInfo"),
                Field("programAdInfoDescEN"),
                Field("programAdInfoDescDE"),
                HTML("<div class=\"form-grouper-label\">Program ad</div>"),
            css_class="form-grouper", css_id="program-ad-grouper"),
            Field("hasPackets"),
            Field("hasBooth"),
            Div(
                Field("boothPositionEN"),
                Field("boothPositionDE"),
                HTML("<div class=\"form-grouper-label\">Booth position</div>"),
            css_class="form-grouper", css_id="booth-grouper"),
            Field("hasRecruitingEvent"),
            Field("hasParticipants"),
            Field("numFreeTickets"),
            Field("additionalContentTextEN"),
            Field("additionalContentTextDE"),
        )
        self.helper.add_input(Submit("Save", "Save"))
项目:YouPBX    作者:JoneXiong    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:eduDjango    作者:yuzhou6    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:Django-IMOOC-Shop    作者:LBruse    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:StudyOnline    作者:yipwinghong    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:xadmin_python3    作者:mahongquan    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:waves-demo    作者:lirmm    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(LoginForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.fields["username"].widget.input_type = "email"  # ugly hack

        self.helper.layout = Layout(
            Field('username', placeholder="Enter Email", autofocus=""),
            Field('password', placeholder="Enter Password"),
            HTML('<a href="{}">Forgot Password?</a>'.format(
                reverse("accounts:password-reset"))),
            Field('remember_me'),
            Submit('sign_in', 'Log in',
                   css_class="btn btn-lg btn-primary btn-block"),
        )
项目:waves-demo    作者:lirmm    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(PasswordChangeForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()

        self.helper.layout = Layout(
            Field('old_password', placeholder="Enter old password",
                  autofocus=""),
            Field('new_password1', placeholder="Enter new password"),
            Field('new_password2', placeholder="Enter new password (again)"),
            Submit('pass_change', 'Change Password', css_class="btn-warning"),
        )
项目:waves-demo    作者:lirmm    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(PasswordResetForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()

        self.helper.layout = Layout(
            Field('email', placeholder="Enter email",
                  autofocus=""),
            Submit('pass_reset', 'Reset Password', css_class="btn-warning"),
        )
项目:waves-demo    作者:lirmm    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(SetPasswordForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()

        self.helper.layout = Layout(
            Field('new_password1', placeholder="Enter new password",
                  autofocus=""),
            Field('new_password2', placeholder="Enter new password (again)"),
            Submit('pass_change', 'Change Password', css_class="btn-warning"),
        )
项目:Django-shop    作者:poetries    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:MoocOnline    作者:My-captain    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:followme    作者:wzqnls    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:mxonline    作者:huwei86    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:mes    作者:osess    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:Charlotte    作者:LiZoRN    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:imooc-django    作者:zaxlct    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f
项目:muxueonline    作者:124608760    | 项目源码 | 文件源码
def convert_field(self, f, counts):
        col_class = "col-sm-%d" % int(math.ceil(12 / counts))
        if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
            f = layout.Field(f)
        if f.wrapper_class:
            f.wrapper_class += " %s" % col_class
        else:
            f.wrapper_class = col_class
        return f