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


Python layout.Layout方法代码示例

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


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

示例1: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        self._email_token = kwargs.pop('email_token', None)
        self._verification_code = self._email_token.verification_code
        super(EmailVerificationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id_form_email_verification'
        self.helper.form_action = reverse_lazy('accounts_email_verification', args=(self._email_token.id,))
        self.helper.layout = Layout(
            Div(
                'code',
            ),
            HTML('''<hr class="full">'''),
            Div(
                Div(
                    HTML('''<a href="{% url 'accounts_register' %}">
                    {{ _('Cancel and sign up again') }}</a>&nbsp;&nbsp;'''),
                    Submit('submit', _('Verify Email address'), css_class='btn-success btn-lg'),
                    css_class='pull-right'
                )
            )
        ) 
开发者ID:pixlie,项目名称:oxidizr,代码行数:23,代码来源:forms.py

示例2: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        super(KeywordCreateForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id_form_keywords_create'
        self.helper.layout = Layout(
            Div(
                Div(
                    'term',
                    css_class='col-sm-6 col-sm-offset-3'
                ),
                css_class='row'
            ),
            HTML('''<hr class="full">'''),
            Div(
                Div(
                    HTML('''<a href="{% url 'keywords_manage' %}">{{ _('Cancel') }}</a>&nbsp;&nbsp;'''),
                    Submit('submit', _('Save'), css_class='btn-success btn-lg'),
                    css_class='pull-right'
                ),
                css_class='row',
            )
        ) 
开发者ID:pixlie,项目名称:oxidizr,代码行数:24,代码来源:forms.py

示例3: helper

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def helper(self):
        # As extra service, auto-adjust the layout based on the project settings.
        # This allows defining the top-row, and still get either 2 or 3 columns
        compact_fields = [name for name in self.fields.keys() if name in self.top_row_fields]
        other_fields = [name for name in self.fields.keys() if name not in self.top_row_fields]
        col_size = int(self.top_row_columns / len(compact_fields))
        col_class = self.top_column_class.format(size=col_size)

        compact_row = Row(*[Column(name, css_class=col_class) for name in compact_fields])

        # The fields are already ordered by the AbstractCommentForm.__init__ method.
        # See where the compact row should be.
        pos = list(self.fields.keys()).index(compact_fields[0])
        new_fields = other_fields
        new_fields.insert(pos, compact_row)

        helper = CompactLabelsCommentFormHelper()
        helper.layout = Layout(*new_fields)
        helper.add_input(SubmitButton())
        helper.add_input(PreviewButton())
        return helper 
开发者ID:82Flex,项目名称:DCRM,代码行数:23,代码来源:compact.py

示例4: get_form

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def get_form(self):
        form = super().get_form()
        form.fields['facility'].widget = forms.HiddenInput()
        form.fields['observation_id'].widget = forms.HiddenInput()
        if self.request.method == 'GET':
            target_id = self.request.GET.get('target_id')
        elif self.request.method == 'POST':
            target_id = self.request.POST.get('target_id')
        cancel_url = reverse('home')
        if target_id:
            cancel_url = reverse('tom_targets:detail', kwargs={'pk': target_id})
        form.helper.layout = Layout(
            HTML('''<p>An observation record already exists in your TOM for this combination of observation ID,
                 facility, and target. Are you sure you want to create this record?</p>'''),
            'target_id',
            'facility',
            'observation_id',
            'confirm',
            FormActions(
                Submit('confirm', 'Confirm'),
                HTML(f'<a class="btn btn-outline-primary" href={cancel_url}>Cancel</a>')
            )
        )
        return form 
开发者ID:TOMToolkit,项目名称:tom_base,代码行数:26,代码来源:views.py

示例5: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_action = reverse('tom_observations:add-existing')
        self.helper.layout = Layout(
            'target_id',
            'confirm',
            Row(
                Column(
                    'facility'
                ),
                Column(
                    'observation_id'
                ),
                Column(
                    ButtonHolder(
                        Submit('submit', 'Add Existing Observation')
                    )
                )
            )
        ) 
开发者ID:TOMToolkit,项目名称:tom_base,代码行数:23,代码来源:forms.py

示例6: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        for field_name in ['groups', 'target_id']:
            self.fields.pop(field_name, None)
        for field in self.fields:
            if field != 'strategy_name':
                self.fields[field].required = False
        self.helper.layout = Layout(
            self.common_layout,
            Div(
                Div(
                    'proposal', 'ipp_value', 'filter', 'instrument_type',
                    css_class='col'
                ),
                Div(
                    'exposure_count', 'exposure_time', 'max_airmass',
                    css_class='col'
                ),
                css_class='form-row',
            )
        ) 
开发者ID:TOMToolkit,项目名称:tom_base,代码行数:23,代码来源:lco.py

示例7: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        self.user = kwargs.pop("user")
        kwargs.update(
            {
                "initial": {
                    "contact_name": self.user.get_full_name,
                    "contact_email": self.user.email,
                }
            }
        )
        super(SponsorApplicationForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.field_class = "col-sm-10 col-lg-10"
        self.helper.form_tag = False
        self.helper.label_class = "col-sm-2 col-lg-2"
        self.helper.layout = Layout(
            "name",
            "external_url",
            "contact_name",
            "contact_email",
            "level",
        ) 
开发者ID:pydata,项目名称:conf_site,代码行数:25,代码来源:forms.py

示例8: __init__

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

        super(ActionItemForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.layout = Layout(
            Row(
                Column(css_class='form-group col-md-3 col-xs-4'),
                Column('due_date', css_class='form-group col-md-3 col-xs-4'),
                Column('instruction', css_class='form-group col-md-3 col-xs-4'),
                css_class='form-row'
            ),
            Row(
                Column(css_class='form-group col-md-3 col-xs-4'),
                Column('comments', css_class='form-group col-md-6 col-xs-6')
            ),
            CustomCheckbox('priority'),
            Row(
                Column(Submit('submit', 'Submit'),
                    css_class='formgroup col-md-offset-3 col-xs-offset-4')
            )
        )

        self.fields['instruction'].queryset = models.ActionInstruction.objects.filter(
            active=True) 
开发者ID:SaturdayNeighborhoodHealthClinic,项目名称:osler,代码行数:27,代码来源:forms.py

示例9: __init__

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

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

        self.helper.layout = Layout(
                Fieldset('Medical',
                         'has_insurance',
                         'ER_visit_last_year',
                         'last_date_physician_visit',
                         'chronic_condition'),
                Fieldset('Social',
                         'lives_alone',
                         'dependents',
                         'resource_access',
                         'transportation'),
                Fieldset('Employment',
                         'currently_employed',
                         'education_level',
                         'work_status',
                         'annual_income')
        )

        self.helper.add_input(Submit('submit', 'Submit')) 
开发者ID:SaturdayNeighborhoodHealthClinic,项目名称:osler,代码行数:27,代码来源:forms.py

示例10: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        super(MessageRecipientForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-md-3'
        self.helper.field_class = 'col-md-8'

        self.fields['recipient_approved_public'].label = "I agree to publish this message and display it publicly in the Happiness Archive."
        self.fields['recipient_approved_public_named'].label = "... and I agree to display our names publicly too."
        self.fields['recipient_approved_public_named'].help_text = "Note: We only publish information if both the sender and the recipients agree."

        self.helper.layout = Layout(
            Fieldset("Privacy and permissions", 'recipient_approved_public', 'recipient_approved_public_named'),
            HTML("<br>"),
            Submit('submit', 'Save privacy choices', css_class='btn-lg centered'),
        ) 
开发者ID:happinesspackets,项目名称:happinesspackets,代码行数:18,代码来源:forms.py

示例11: __init__

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

        color_scheme_fields = self.init_color_scheme_switch(
            color_scheme=kwargs['initial'].get('color_scheme', None),
            field_kwargs={'widget': Select2Widget})

        self.helper.layout = Layout(
            TabHolder(
                Tab(_('Options'),
                    'depth',
                    'page_id',
                    'from_root',
                    'site',
                    'language',
                    ),
                Tab(_('Styles'),
                    'layout',
                    Fieldset(
                        'Themes', 'theme', *color_scheme_fields),
                    ),
            ),
        ) 
开发者ID:django-leonardo,项目名称:django-leonardo,代码行数:25,代码来源:forms.py

示例12: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Row(
                Column('email', css_class='form-group col-md-6 mb-0'),
                Column('password', css_class='form-group col-md-6 mb-0'),
                css_class='form-row'
            ),
            'address_1',
            'address_2',
            Row(
                Column('city', css_class='form-group col-md-6 mb-0'),
                Column('state', css_class='form-group col-md-4 mb-0'),
                Column('zip_code', css_class='form-group col-md-2 mb-0'),
                css_class='form-row'
            ),
            'check_me_out',
            Submit('submit', 'Sign in')
        ) 
开发者ID:sibtc,项目名称:advanced-crispy-forms-examples,代码行数:22,代码来源:forms.py

示例13: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        self.collection = kwargs.pop("collection", None)
        super(BaseBulkSeedForm, self).__init__(*args, **kwargs)
        self.fields['history_note'].help_text = HISTORY_NOTE_HELP_ADD
        cancel_url = reverse('collection_detail', args=[self.collection])
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                '',
                'seeds_type',
                'tokens',
                'history_note',
                css_class='crispy-form-custom'
            ),
            FormActions(
                Submit('submit', 'Save'),
                Button('cancel', 'Cancel',
                       onclick="window.location.href='{0}'".format(cancel_url))
            )
        ) 
开发者ID:gwu-libraries,项目名称:sfm-ui,代码行数:22,代码来源:forms.py

示例14: form

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def form(self):
        form = super(FilterSet, self).form

        if compat.is_crispy():
            from crispy_forms.helper import FormHelper
            from crispy_forms.layout import Layout, Submit

            layout_components = list(form.fields.keys()) + [
                Submit('', _('Submit'), css_class='btn-default'),
            ]
            helper = FormHelper()
            helper.form_method = 'GET'
            helper.template_pack = 'bootstrap3'
            helper.layout = Layout(*layout_components)

            form.helper = helper

        return form 
开发者ID:BeanWei,项目名称:Dailyfresh-B2C,代码行数:20,代码来源:filterset.py

示例15: __init__

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Layout [as 别名]
def __init__(self, *args, **kwargs):
        super(SuggestionForm, self).__init__(*args, **kwargs)
        # Translators: This labels a textfield where users can enter the name of the potential partner they'll suggest
        self.fields["suggested_company_name"].label = _("Name of the potential partner")
        # Translators: This labels a textfield where users can enter the description of the potential partner they'll suggest
        self.fields["description"].label = _("Description")
        # Translators: This labels a textfield where users can enter the website URL of the potential partner they'll suggest
        self.fields["company_url"].label = _("Website")
        # @TODO: This sort of gets repeated in PartnerSuggestionView.
        # We could probably be factored out to a common place for DRYness.
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.form_class = "form-horizontal"
        self.helper.label_class = "col-lg-3"
        self.helper.field_class = "col-lg-7"
        self.helper.layout = Layout(
            "suggested_company_name",
            "description",
            "company_url",
            "next",
            # Translators: This labels a button which users click to submit their suggestion.
            Submit("submit", _("Submit"), css_class="center-block"),
        ) 
开发者ID:WikipediaLibrary,项目名称:TWLight,代码行数:25,代码来源:forms.py


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