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


Python FormHelper.form_action方法代码示例

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


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

示例1: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
 def helper(self):
     """django-uni-form layout specification."""
     helper = FormHelper()
     if self.instance and self.instance.id:
         helper.form_action = reverse("media-edit", args=[self.instance.id])
         delete = Button("delete", "Delete This Item", css_class="secondaryAction")
         helper.add_input(delete)
     else:
         helper.form_action = reverse("media-add")
         another = Submit("save_add", "Save and Add Another", css_class="primaryAction")
         helper.add_input(another)
     submit = Submit("save", "Save", css_class="primaryAction")
     helper.add_input(submit)
     helper.form_method = "POST"
     return helper
开发者ID:jmbowman,项目名称:media_library,代码行数:17,代码来源:forms.py

示例2: test_uni_form_formset_with_helper_without_layout

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def test_uni_form_formset_with_helper_without_layout(self):
        template = get_template_from_string(u"""
            {% load uni_form_tags %}
            {% uni_form testFormSet formset_helper %}
        """)
        
        form_helper = FormHelper()    
        form_helper.form_id = 'thisFormsetRocks'
        form_helper.form_class = 'formsets-that-rock'
        form_helper.form_method = 'POST'
        form_helper.form_action = 'simpleAction'
                
        TestFormSet = formset_factory(TestForm, extra = 3)
        testFormSet = TestFormSet()
        
        c = Context({'testFormSet': testFormSet, 'formset_helper': form_helper, 'csrf_token': _get_new_csrf_key()})
        html = template.render(c)        

        self.assertEqual(html.count('<form'), 1)
        self.assertEqual(html.count("<input type='hidden' name='csrfmiddlewaretoken'"), 1)

        # Check formset management form
        self.assertTrue('form-TOTAL_FORMS' in html)
        self.assertTrue('form-INITIAL_FORMS' in html)
        self.assertTrue('form-MAX_NUM_FORMS' in html)
    
        self.assertTrue('class="uniForm formsets-that-rock"' in html)
        self.assertTrue('method="post"' in html)
        self.assertTrue('id="thisFormsetRocks">' in html)
        self.assertTrue('action="%s"' % reverse('simpleAction') in html)
开发者ID:EnTeQuAk,项目名称:django-uni-form,代码行数:32,代码来源:tests.py

示例3: test_uni_form_formset

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def test_uni_form_formset(self):
        template = get_template_from_string(u"""
            {% load uni_form_tags %}
            {% uni_form testFormSet formset_helper %}
        """)
        
        form_helper = FormHelper()    
        form_helper.form_id = 'this-formset-rocks'
        form_helper.form_class = 'formsets-that-rock'
        form_helper.form_method = 'GET'
        form_helper.form_action = 'simpleAction'
                
        from django.forms.models import formset_factory
        TestFormSet = formset_factory(TestForm, extra = 3)
        testFormSet = TestFormSet()
        
        c = Context({'testFormSet': testFormSet, 'formset_helper': form_helper})
        html = template.render(c)        

        self.assertTrue('<form' in html)
        self.assertEqual(html.count('<form'), 1)
        self.assertTrue('class="uniForm formsets-that-rock"' in html)
        self.assertTrue('method="get"' in html)
        self.assertTrue('id="this-formset-rocks">' in html)
        self.assertTrue('action="%s"' % reverse('simpleAction') in html)
开发者ID:typeish,项目名称:django-uni-form,代码行数:27,代码来源:tests.py

示例4: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
 def helper(self):
     helper = FormHelper()
     helper.add_input(Submit('submit', _('Search')))
     
     helper.form_action = reverse('search:search')
     helper.form_method = 'get'
     return helper
开发者ID:GISAElkartea,项目名称:antxetamedia,代码行数:9,代码来源:forms.py

示例5: test_uni_form_with_helper_attributes

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def test_uni_form_with_helper_attributes(self):
        form_helper = FormHelper()    
        form_helper.form_id = 'this-form-rocks'
        form_helper.form_class = 'forms-that-rock'
        form_helper.form_method = 'GET'
        form_helper.form_action = 'simpleAction'
    
        template = get_template_from_string(u"""
            {% load uni_form_tags %}
            {% uni_form form form_helper %}
        """)        

        # now we render it
        c = Context({'form': TestForm(), 'form_helper': form_helper})            
        html = template.render(c)        
        
        # Lets make sure everything loads right
        self.assertTrue('<form' in html)
        self.assertTrue('class="uniForm forms-that-rock"' in html)
        self.assertTrue('method="get"' in html)
        self.assertTrue('id="this-form-rocks">' in html)
        self.assertTrue('action="%s"' % reverse('simpleAction') in html)
        
        # now lets remove the form tag and render it again. All the True items above
        # should now be false because the form tag is removed.
        form_helper.form_tag = False 
        html = template.render(c)        
        self.assertFalse('<form' in html)        
        self.assertFalse('class="uniForm forms-that-rock"' in html)
        self.assertFalse('method="get"' in html)
        self.assertFalse('id="this-form-rocks">' in html)
开发者ID:typeish,项目名称:django-uni-form,代码行数:33,代码来源:tests.py

示例6: test_uni_form_formset

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def test_uni_form_formset(self):
        template = get_template_from_string(
            u"""
            {% load uni_form_tags %}
            {% uni_form testFormSet formset_helper %}
        """
        )

        form_helper = FormHelper()
        form_helper.form_id = "thisFormsetRocks"
        form_helper.form_class = "formsets-that-rock"
        form_helper.form_method = "POST"
        form_helper.form_action = "simpleAction"

        TestFormSet = formset_factory(TestForm, extra=3)
        testFormSet = TestFormSet()

        c = Context({"testFormSet": testFormSet, "formset_helper": form_helper, "csrf_token": _get_new_csrf_key()})
        html = template.render(c)

        self.assertEqual(html.count("<form"), 1)
        self.assertEqual(html.count("<input type='hidden' name='csrfmiddlewaretoken'"), 1)

        self.assertTrue('class="uniForm formsets-that-rock"' in html)
        self.assertTrue('method="post"' in html)
        self.assertTrue('id="thisFormsetRocks">' in html)
        self.assertTrue('action="%s"' % reverse("simpleAction") in html)
开发者ID:Bauke900,项目名称:dnevnik,代码行数:29,代码来源:tests.py

示例7: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
 def helper(self):
     helper = FormHelper()
     submit = Submit('submit', 'Submit your application')
     helper.add_input(submit)
     helper.form_action = self.form_action
     helper.form_method = 'POST'
     return helper
开发者ID:keegancsmith,项目名称:Umonya-Website,代码行数:9,代码来源:forms.py

示例8: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
 def helper(self):
     form = CreateClientForm()
     helper = FormHelper()
     reset = Reset('','Reset')
     helper.add_input(reset)
     submit = Submit('','Create Client')
     helper.add_input(submit)
     helper.form_action = '/account/clients'
     helper.form_method = 'POST'
     return helper
开发者ID:CREO-Agency,项目名称:oauth2app,代码行数:12,代码来源:forms.py

示例9: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
 def helper(self):
     form = LoginForm()
     helper = FormHelper()
     reset = Reset('','Reset')
     helper.add_input(reset)
     submit = Submit('','Authenticate')
     helper.add_input(submit)
     helper.form_action = '/account/aadhaar/authenticate'
     helper.form_method = 'POST'
     return helper
开发者ID:jasarjasu786,项目名称:aadhaar-oauth2-server,代码行数:12,代码来源:forms.py

示例10: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
 def helper(self):
     form = GroupForm()
     helper = FormHelper()
     reset = Reset("", "Reset")
     helper.add_input(reset)
     submit = Submit("", "Create Group")
     helper.add_input(submit)
     helper.form_action = "/account/groups"
     helper.form_method = "POST"
     return helper
开发者ID:JDSchmitzMedia,项目名称:OMS-RegistryServer,代码行数:12,代码来源:forms.py

示例11: set_helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
 def set_helper(self):
     helper = FormHelper()
     reset = Reset('','Reset')
     helper.add_input(reset)
     submit = Submit('','Submit')
     helper.add_input(submit)
     helper.form_action = ''
     helper.form_method = 'POST'
     helper.form_class="blueForms"
     self.helper = helper
开发者ID:pingali,项目名称:bhagiratha_alt,代码行数:12,代码来源:forms.py

示例12: test_formset_layout

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def test_formset_layout(self):
        template = get_template_from_string(u"""
            {% load uni_form_tags %}
            {% uni_form testFormSet formset_helper %}
        """)
        
        form_helper = FormHelper()    
        form_helper.form_id = 'thisFormsetRocks'
        form_helper.form_class = 'formsets-that-rock'
        form_helper.form_method = 'POST'
        form_helper.form_action = 'simpleAction'
        form_helper.add_layout(
            Layout(
                Fieldset("Item {{ forloop.counter }}",
                    'is_company',
                    'email',
                ),
                HTML("{% if forloop.first %}Note for first form only{% endif %}"),
                Row('password1', 'password2'),
                Fieldset("",
                    'first_name',
                    'last_name'
                )
            )
        )
                
        TestFormSet = formset_factory(TestForm, extra = 3)
        testFormSet = TestFormSet()
        
        c = Context({
            'testFormSet': testFormSet, 
            'formset_helper': form_helper, 
            'csrf_token': _get_new_csrf_key()
        })
        html = template.render(c)        

        # Check form parameters
        self.assertEqual(html.count('<form'), 1)
        self.assertEqual(html.count("<input type='hidden' name='csrfmiddlewaretoken'"), 1)

        self.assertTrue('class="uniForm formsets-that-rock"' in html)
        self.assertTrue('method="post"' in html)
        self.assertTrue('id="thisFormsetRocks">' in html)
        self.assertTrue('action="%s"' % reverse('simpleAction') in html)

        # Check form layout
        self.assertTrue('Item 1' in html)
        self.assertTrue('Item 2' in html)
        self.assertTrue('Item 3' in html)
        self.assertEqual(html.count('Note for first form only'), 1)
        self.assertEqual(html.count('formRow'), 3)
开发者ID:EnTeQuAk,项目名称:django-uni-form,代码行数:53,代码来源:tests.py

示例13: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def helper(self):
        
        print "ProfileForm.helper In helper"
        form = ProfileForm() 
        helper = FormHelper()
        reset = Reset('','Reset')
        helper.add_input(reset)
        submit = Submit('','Update')
        helper.add_input(submit)
        helper.form_action = '/account/profile/edit'
        helper.form_method = 'POST'
        helper.form_class="blueForms"

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

示例14: test_formset_layout

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def test_formset_layout(self):
        template = get_template_from_string(
            u"""
            {% load uni_form_tags %}
            {% uni_form testFormSet formset_helper %}
        """
        )

        form_helper = FormHelper()
        form_helper.form_id = "thisFormsetRocks"
        form_helper.form_class = "formsets-that-rock"
        form_helper.form_method = "POST"
        form_helper.form_action = "simpleAction"
        form_helper.add_layout(
            Layout(
                Fieldset("Item {{ forloop.counter }}", "is_company", "email"),
                HTML("{% if forloop.first %}Note for first form only{% endif %}"),
                Row("password1", "password2"),
                Fieldset("", "first_name", "last_name"),
            )
        )

        TestFormSet = formset_factory(TestForm, extra=3)
        testFormSet = TestFormSet()

        c = Context({"testFormSet": testFormSet, "formset_helper": form_helper, "csrf_token": _get_new_csrf_key()})
        html = template.render(c)

        # Check form parameters
        self.assertEqual(html.count("<form"), 1)
        self.assertEqual(html.count("<input type='hidden' name='csrfmiddlewaretoken'"), 1)

        self.assertTrue('class="uniForm formsets-that-rock"' in html)
        self.assertTrue('method="post"' in html)
        self.assertTrue('id="thisFormsetRocks">' in html)
        self.assertTrue('action="%s"' % reverse("simpleAction") in html)

        # Check form layout
        self.assertTrue("Item 1" in html)
        self.assertTrue("Item 2" in html)
        self.assertTrue("Item 3" in html)
        self.assertEqual(html.count("Note for first form only"), 1)
        self.assertEqual(html.count("formRow"), 3)
开发者ID:Bauke900,项目名称:dnevnik,代码行数:45,代码来源:tests.py

示例15: helper

# 需要导入模块: from uni_form.helpers import FormHelper [as 别名]
# 或者: from uni_form.helpers.FormHelper import form_action [as 别名]
    def helper(self):
      form = HelperAuthenticationForm()
      helper = FormHelper()
  
      

      login = Submit('login','Submit',css_class='primaryAction')
      helper.add_input(login)
  
      helper.form_action = 'login_form'
      helper.form_method = 'POST' # Only GET and POST are legal
  
      layout = Layout(
      	Fieldset('',
      	   HTML('<input type="hidden" name="next" value="{{ request.GET.next }}" />'),
      	   'identification', 'password', 'remember_me', css_class='inlineLabels'),
      )
  
      helper.add_layout(layout)
      return helper
开发者ID:dshng,项目名称:django-userena,代码行数:22,代码来源:forms.py


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