#30596: Form method `has_changed` always returns True if form has the
SplitArrayField field
--------------------------------------------+------------------------
               Reporter:  Evgeniy Krysanov  |          Owner:  nobody
                   Type:  Bug               |         Status:  new
              Component:  Forms             |        Version:  2.2
               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                 |
--------------------------------------------+------------------------
 Code example:

 {{{
 # models.py
 class Signal(models.Model):
     order_price = ArrayField(models.FloatField(), default=list)

 # admin.py
 class SignalForm(forms.ModelForm):
     order_price = SplitArrayField(base_field=forms.FloatField(), size=3,
 remove_trailing_nulls=True, required=False)

 @admin.register(Signal)
 class SignalAdmin(admin.ModelAdmin):
     form = SignalForm

     def save_model(self, request, obj, form, change):
         super().save_model(request, obj, form, change)
         print(form.has_changed())  # Always True even if no values was
 changed
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30596>
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/051.c5a9e2e3c46db51c8c28e3e4c30365af%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to