#28799: ModelFormSet is incorrectly considered as not valid if initial form is 
not
changed and validate_min=True
-------------------------------------------+------------------------
               Reporter:  Sergey Fedoseev  |          Owner:  nobody
                   Type:  Bug              |         Status:  new
              Component:  Forms            |        Version:  1.11
               Severity:  Normal           |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 I encountered this while trying to migrate from 1.10 to 1.11, ModelFormSet
 that was valid on 1.10 became invalid on 1.11.
 Here's test case:
 {{{
 from django.db import models

 from django.test import TestCase
 from django.forms.models import modelformset_factory

 class Price(models.Model):
     quantity = models.PositiveIntegerField()

 class ModelFormsetTest(TestCase):
     def test_modelformset_validate_min_and_initial(self):
         data = {
             'form-TOTAL_FORMS': '2',
             'form-INITIAL_FORMS': '0',
             'form-0-quantity': '1',
         }

         FormSet = modelformset_factory(Price, fields=('quantity',),
 min_num=1, validate_min=True)
         formset = FormSet(data, initial=[{'quantity': 1}])
         self.assertTrue(formset.is_valid())
 }}}

 Bisected to f5c6295797b8332134fd89e0209a18a1d1d45e0c.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28799>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.34ca30cb8d241572efefc694ad3aaefd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to