Re: Improve adding data to forms programmatically

2015-09-17 Thread 'Moritz Sichert' via Django developers (Contributions to Django itself)
Am 17.09.2015 06:24, schrieb Yo-Yo Ma: > To clarify, are you referring to a state where there are validation errors > and the form is redisplayed, whereupon your change the value back to the > original value? No, there don't have to be validation errors. I want to redisplay the form to the user

Re: Improve adding data to forms programmatically

2015-09-16 Thread Yo-Yo Ma
To clarify, are you referring to a state where there are validation errors and the form is redisplayed, whereupon your change the value back to the original value? Pertaining the problem you mentioned last (displaying the intermediary result): you are probably better off using the value from th

Re: Improve adding data to forms programmatically

2015-09-16 Thread 'Moritz Sichert' via Django developers (Contributions to Django itself)
If the user changes a field "username" for example and then saves his changes form.has_changed() will detect correctly that the username has changed. If the user then goes back and changes the username to the old value, form.has_changed() will return True because the new input differs from the firs

Re: Improve adding data to forms programmatically

2015-09-16 Thread Florian Apolloner
What is preventing you from passing the saved changes in via initial? On Tuesday, September 15, 2015 at 10:23:02 PM UTC+2, Moritz S. wrote: > > Hello, > > currently you can add data to forms either by passing it into the > "initial" or the "data" argument of Form. However sometimes I have the >

Improve adding data to forms programmatically

2015-09-15 Thread 'Moritz Sichert' via Django developers (Contributions to Django itself)
Hello, currently you can add data to forms either by passing it into the "initial" or the "data" argument of Form. However sometimes I have the need to add data to a Form that isn't request.POST and doesn't come from an http request. My use case is the following: I have a form where a user can e