Python django.forms.formsets.all_valid() Examples
The following are 15
code examples of django.forms.formsets.all_valid().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.forms.formsets
, or try the search function
.
Example #1
Source File: test_formsets.py From djongo with GNU Affero General Public License v3.0 | 6 votes |
def test_valid(self): data = { 'choices-TOTAL_FORMS': '2', 'choices-INITIAL_FORMS': '0', 'choices-MIN_NUM_FORMS': '0', 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', 'choices-1-votes': '1', } ChoiceFormSet = formset_factory(Choice) formset1 = ChoiceFormSet(data, auto_id=False, prefix='choices') formset2 = ChoiceFormSet(data, auto_id=False, prefix='choices') self.assertIs(all_valid((formset1, formset2)), True) expected_errors = [{}, {}] self.assertEqual(formset1._errors, expected_errors) self.assertEqual(formset2._errors, expected_errors)
Example #2
Source File: test_formsets.py From djongo with GNU Affero General Public License v3.0 | 6 votes |
def test_invalid(self): """all_valid() validates all forms, even when some are invalid.""" data = { 'choices-TOTAL_FORMS': '2', 'choices-INITIAL_FORMS': '0', 'choices-MIN_NUM_FORMS': '0', 'choices-0-choice': 'Zero', 'choices-0-votes': '', 'choices-1-choice': 'One', 'choices-1-votes': '', } ChoiceFormSet = formset_factory(Choice) formset1 = ChoiceFormSet(data, auto_id=False, prefix='choices') formset2 = ChoiceFormSet(data, auto_id=False, prefix='choices') self.assertIs(all_valid((formset1, formset2)), False) expected_errors = [{'votes': ['This field is required.']}, {'votes': ['This field is required.']}] self.assertEqual(formset1._errors, expected_errors) self.assertEqual(formset2._errors, expected_errors)
Example #3
Source File: test_formsets.py From djongo with GNU Affero General Public License v3.0 | 6 votes |
def test_valid(self): data = { 'choices-TOTAL_FORMS': '2', 'choices-INITIAL_FORMS': '0', 'choices-MIN_NUM_FORMS': '0', 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', 'choices-1-votes': '1', } ChoiceFormSet = formset_factory(Choice) formset1 = ChoiceFormSet(data, auto_id=False, prefix='choices') formset2 = ChoiceFormSet(data, auto_id=False, prefix='choices') self.assertIs(all_valid((formset1, formset2)), True) expected_errors = [{}, {}] self.assertEqual(formset1._errors, expected_errors) self.assertEqual(formset2._errors, expected_errors)
Example #4
Source File: test_formsets.py From djongo with GNU Affero General Public License v3.0 | 6 votes |
def test_invalid(self): """all_valid() validates all forms, even when some are invalid.""" data = { 'choices-TOTAL_FORMS': '2', 'choices-INITIAL_FORMS': '0', 'choices-MIN_NUM_FORMS': '0', 'choices-0-choice': 'Zero', 'choices-0-votes': '', 'choices-1-choice': 'One', 'choices-1-votes': '', } ChoiceFormSet = formset_factory(Choice) formset1 = ChoiceFormSet(data, auto_id=False, prefix='choices') formset2 = ChoiceFormSet(data, auto_id=False, prefix='choices') self.assertIs(all_valid((formset1, formset2)), False) expected_errors = [{'votes': ['This field is required.']}, {'votes': ['This field is required.']}] self.assertEqual(formset1._errors, expected_errors) self.assertEqual(formset2._errors, expected_errors)
Example #5
Source File: inline.py From StormOnline with Apache License 2.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #6
Source File: inline.py From weibo-analysis-system with MIT License | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #7
Source File: inline.py From myblog with GNU Affero General Public License v3.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #8
Source File: inline.py From CTF_AWD_Platform with MIT License | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #9
Source File: inline.py From django_OA with GNU General Public License v3.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #10
Source File: inline.py From Mxonline3 with Apache License 2.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #11
Source File: inline.py From imoocc with GNU General Public License v2.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #12
Source File: inline.py From devops with MIT License | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #13
Source File: inline.py From online with GNU Affero General Public License v3.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #14
Source File: inline.py From Dailyfresh-B2C with Apache License 2.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result
Example #15
Source File: inline.py From ImitationTmall_Django with GNU General Public License v3.0 | 5 votes |
def valid_forms(self, result): return all_valid(self.formsets) and result