#24428: Model field with default=callable and choices is always reported as 
changed
--------------------------+------------------------------------
     Reporter:  CarstenF  |                    Owner:  nobody
         Type:  Bug       |                   Status:  new
    Component:  Forms     |                  Version:  1.7
     Severity:  Normal    |               Resolution:
     Keywords:            |             Triage Stage:  Accepted
    Has patch:  0         |      Needs documentation:  0
  Needs tests:  0         |  Patch needs improvement:  0
Easy pickings:  0         |                    UI/UX:  0
--------------------------+------------------------------------

Comment (by CarstenF):

 Looking at Django 1.7.5's `BaseForm.changed_data()`, debugging indicates
 that line
 {{{
 #!python
 elif field._has_changed(initial_value, data_value):
 }}}
 for field `monat` of my above example turns into
 {{{
 #!python
 elif field._has_changed(u"", 1):
 }}}
 Thus, afaics, it rather seems that `initial_value` is wrongly determined
 earlier, when call `hidden_widget.value_from_datadict(self.data,
 self.files, initial_prefixed_name)` returns `None` rather than 1.

 `self.data` in turn has no key `initial_prefixed_name` (here "initial-
 monat"), causing the `None` return value above.

 What I wonder about is how and where "initial-monat" should have been
 added to `self.data` in the first place...?

--
Ticket URL: <https://code.djangoproject.com/ticket/24428#comment:3>
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/066.8a819a1df371ba5418938719f80e854b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to