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


Python FormHelper.layout方法代码示例

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


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

示例1: test_i18n

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import layout [as 别名]
    def test_i18n(self):
        template = get_template_from_string(u"""
            {% load uni_form_tags %}
            {% uni_form form form.helper %}
        """)
        form = TestForm()
        form_helper = FormHelper()
        form_helper.layout = Layout(
            HTML(_("i18n text")),
            Fieldset(
                _("i18n legend"),
                'first_name',
                'last_name',
            )
        )
        form.helper = form_helper

        html = template.render(Context({'form': form}))
开发者ID:EnTeQuAk,项目名称:django-uni-form,代码行数:20,代码来源:tests.py

示例2: profile_edit

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import layout [as 别名]
def profile_edit(request, template_name="profiles/profile_edit.html"):

    profile = request.user.get_profile()
    form = ProfileForm(request.POST or None, instance=profile)

    if form.is_valid():
        form.save()
        msg = 'Profile edited'
        messages.add_message(request, messages.INFO, msg)
        return HttpResponseRedirect(reverse("profile_detail", kwargs={"github_account":profile.github_account }))
        
    # TODO - move this to a template
    github_account = """
    <div 
        id="div_id_github_account" 
        class="ctrlHolder"><label for="id_github_account" >Github account</label><strong>{0}</strong></div>
    """.format(profile.github_account)
        
    helper = FormHelper()
    helper.form_class = "profile-edit-form"
    helper.layout = Layout(
        Fieldset(
            '',
            HTML(github_account),
            'bitbucket_url',
            'google_code_url',
            'email',
        ),
        ButtonHolder(
            Submit('edit', 'Edit', css_class="awesome forestgreen"),
        )
    )        

    return render_to_response(template_name,
        {
            "profile": profile,
            "form": form,
            "helper":helper,
        },
        context_instance=RequestContext(request)
    )
开发者ID:benracine,项目名称:Vispack,代码行数:43,代码来源:views.py

示例3: set_helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import layout [as 别名]
    def set_helper(self):
        print "AadhaarLoginForm.helper In helper"
        #form = AadhaarLoginForm()
        helper = FormHelper()
        reset = Reset('','Reset')
        helper.add_input(reset)
        submit = Submit('','Authenticate')
        helper.add_input(submit)
        helper.form_action = '/aadhaar/authenticate/' + self.detail 
        helper.form_method = 'POST'
        helper.form_class="blueForms"

        style="""
<style>
fieldset.formRow {
         margin-bottom: 1em;
         border-width: 0 0 1px 0;
         border-color:#CCCCCC;
         border-style:solid;
}
</style>
"""
        common_layout =  Layout(
            Fieldset('Required Parameters',
                     'aadhaar_id',
                     'aadhaar_attributes',
                     )
            )
        pi_layout= Layout(
            Fieldset("Personally Identifiable Information",
                     'aadhaar_pi_match',
                     'aadhaar_name',
                     'aadhaar_dob', 
                     'aadhaar_age',
                     'aadhaar_gender',
                     'aadhaar_email',
                     'aadhaar_phone',
                     )
            )
        pa_layout = Layout(
            Fieldset("Address",
                     'aadhaar_pa_match',
                     'aadhaar_co',
                     'aadhaar_house',
                     'aadhaar_street',
                     'aadhaar_landmark',
                     'aadhaar_locality',
                     'aadhaar_vtc',
                     'aadhaar_subdist',
                     'aadhaar_district',
                     'aadhaar_state',
                     'aadhaar_pincode',
                     'aadhaar_postoffice')
            )
        
        if self.detail == "personal": 
            layout = Layout(common_layout, pi_layout)
        elif self.detail == "address":
            layout = Layout(common_layout, pa_layout)
        else:
            layout = Layout(common_layout, pi_layout, pa_layout)
            
        helper.layout = layout

        self.helper = helper
开发者ID:Ghost-script,项目名称:django-aadhaar,代码行数:67,代码来源:forms.py


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