#22969: Forms show_hidden_initial not is_valid() and fix => lost changes in
valid
fields
-------------------------------------+-------------------------------------
Reporter: dibrovsd@… | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Resolution:
Keywords: Form | Triage Stage:
show_hidden_initial changed_data | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by dibrovsd@…):
Replying to [comment:4 adambrenecki]:
> So, since show_hidden_initial isn't a part of Django's public API, but
rather used internally by other parts of Django, and therefore it probably
shouldn't be called from user code.
>
> Are you using this from somewhere else inside Django itself, or from
third-party/user code?
This is my code. i read django source-code.
Without this parameter, it is impossible to write a serious application.
Two operators will overwrite each other's changes, when editing an object.
If they edit different fields, it should not interfere with each other.
But without show_hidden_initial, the second operator will always overwrite
any changes the first statement, even if it is not explicitly changed the
field.
Example:
form has 2 field.
if not use show_hidden_initial, Form see has_change() as compare initial
and data params.
initial - value from database before save cleaned_data
0) field_1 = 1 and field_2 = 1
1) User 1 open form
2) User 2 open form
3) User 1 change field_1 to "2" and save form (in database field_1 = "2")
4) User 2 change field_2 to "2" and save form:
initial for field_1 == "2" (user 2 changes) and data for field_1 == "1"
(this value is obsolete)
form mark field_1 as changed from "2" to "1" and restore field_1 value and
override changes
It is very important
Without show_hidden_initial,
In a parallel environment, the second user will always overwrite all
changes first
--
Ticket URL: <https://code.djangoproject.com/ticket/22969#comment:7>
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/076.34e793c344286e540f8f4fab4486152e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.