#32625: JSONField with callable default reports ModelForm.has_changed() when it
hasn't
-------------------------------+--------------------------------------
     Reporter:  Stuart Kelly   |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  closed
    Component:  Forms          |                  Version:  3.2
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => invalid
 * component:  Uncategorized => Forms


Comment:

 Fields with callable defaults use `show_hidden_initial` (renders a hidden
 widget with initial value after the widget), that's why you need to pass
 initial data to forms, e.g.
 {{{
 >>> data = {'modifications': '[]', 'initial-modifications': '[]'}
 >>> form = VehicleForm(data, instance=vehicle)
 >>> form.has_changed()
 False
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32625#comment:1>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.3f56547d2dfdc3344e5137617e46921d%40djangoproject.com.

Reply via email to