Django

Code

Ticket #3639 (new)

Opened 1 year ago

Last modified 3 weeks ago

use newforms in generic create_update view

Reported by: webograph <webograph@eml.cc> Assigned to:
Milestone: 1.0 alpha Component: Generic views
Version: SVN Keywords: newforms
Cc: elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com, mir@noris.de, jeff@bitprophet.org, jefferya@programmerq.net Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

in order to make newforms available to the generic create_update view (as it is planned, i suppose), i modified the create_update.py to make use of newforms. i have not found any discussion on this, which will definitely have to take place, but as of already using it myself, i hope it can be useful for others and maybe be the base for the final change.

existing templates will probably still work but might break.

i'm not sure what the new_data = request.POST.copy() (2x) was exactly intended to prevent, so i left them in place; maybe they are not necessary any more.

Attachments

create_update__newforms.diff (3.5 kB) - added by webograph <webograph@eml.cc> on 03/02/07 17:09:36.
r6635_create_update_newforms.diff (4.9 kB) - added by brosner on 10/31/07 15:34:52.
updated to trunk. fixed several issues with last patch and added form and formfield_callback overrides.
r6635_create_update_newforms_with_docs_and_tests.diff (16.6 kB) - added by brosner on 10/31/07 23:07:10.
patch with docs and tests
r6635_create_update_newforms_with_docs_and_tests2.diff (17.2 kB) - added by brosner on 11/02/07 15:12:30.
revised docs and allowed fields to be customized
r6635_create_update_newforms3.diff (19.7 kB) - added by brosner on 11/02/07 19:13:33.
created save_callback for custom saving of form data
create_update_newforms4.diff (21.6 kB) - added by brosner on 12/20/07 18:47:09.
updated to r6963 and using ModelForm? now. Backwards Incompatible.
create_update_newforms5.diff (22.2 kB) - added by brosner on 02/21/08 22:07:46.
updated to r7140 and is now backward compatible by accepting a Model instance.
3639.diff (24.3 kB) - added by gwilson on 06/16/08 15:48:34.
some updates to Brian's latest patch

Change History

03/02/07 17:09:36 changed by webograph <webograph@eml.cc>

  • attachment create_update__newforms.diff added.

03/02/07 19:03:25 changed by ubernostrum

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

I believe the switchover for generic views going to newforms will be sometime after the 0.96 release.

04/10/07 22:56:37 changed by SmileyChris

  • stage changed from Unreviewed to Ready for checkin.

Just in case it's useful for newforms branch I'll mark this ready for checkin for Adrian to have a look at.

04/11/07 05:05:01 changed by webograph <webograph@eml.cc>

i checked that request.POST.copy() issue, by the way. it's not required by the forms procedure any more, but as data from request.FILE is added to the data dictionary, the copy() is still required.

04/25/07 04:01:24 changed by mtredinnick

  • stage changed from Ready for checkin to Accepted.

Isn't this dependent on form_for_instance() being able to handle things like FileField fields?

Please move back to "ready for checkin" if I've missed something, but I think it's still missing some dependencies.

07/06/07 19:45:08 changed by anonymous

  • cc set to elsdoerfer@gmail.com.

10/31/07 15:34:52 changed by brosner

  • attachment r6635_create_update_newforms.diff added.

updated to trunk. fixed several issues with last patch and added form and formfield_callback overrides.

10/31/07 15:37:18 changed by brosner

  • needs_docs set to 1.
  • needs_tests set to 1.

I have attached a patch that fixes several issues with the last one. Uses newforms correctly. This patch applies cleanly against trunk at r6635. I added form and formfield_callback overrides to allow for customization of the form. I removed the follow kwarg as it is not needed any longer with newforms. I am currently working on some tests and revised docs.

10/31/07 16:29:39 changed by Thomas Güttler (Home) <guettli.djangotrac@thomas-guettler.de>

  • cc changed from elsdoerfer@gmail.com to elsdoerfer@gmail.com, hv@tbz-pariv.de.

10/31/07 23:07:10 changed by brosner

  • attachment r6635_create_update_newforms_with_docs_and_tests.diff added.

patch with docs and tests

10/31/07 23:10:21 changed by brosner

  • needs_docs deleted.
  • needs_tests deleted.

I have completed writing the tests and revised the docs. For some reason Trac doesn't seem to know how to display my diff.

This change does introduce a backward incompatibility in the templates that is similar to those who move to newforms anyways. Let me know if I missed anything or need to revise anything in the patch.

11/02/07 15:12:30 changed by brosner

  • attachment r6635_create_update_newforms_with_docs_and_tests2.diff added.

revised docs and allowed fields to be customized

11/02/07 19:13:33 changed by brosner

  • attachment r6635_create_update_newforms3.diff added.

created save_callback for custom saving of form data

11/17/07 18:15:48 changed by niels

  • cc changed from elsdoerfer@gmail.com, hv@tbz-pariv.de to elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com.

12/01/07 12:48:33 changed by brosner

I want to point out that I have verified the patch against latest trunk r6798. However, this patch is pending the ModelForm? feature found in #6042.

12/10/07 18:56:52 changed by brosner

  • owner changed from nobody to brosner.
  • status changed from new to assigned.

12/20/07 18:47:09 changed by brosner

  • attachment create_update_newforms4.diff added.

updated to r6963 and using ModelForm? now. Backwards Incompatible.

12/20/07 18:48:57 changed by brosner

I have attached a new patch that is now working with ModelForm. To do this I made this change as backwards incompatible. I think that should not be the case and use a helper function to dynamically create the ModelForm? from the model at run-time. This is found in the newforms-admin branch (modelform_for_model) so it might be good to port it to trunk? What do people think about this?

02/21/08 22:07:46 changed by brosner

  • attachment create_update_newforms5.diff added.

updated to r7140 and is now backward compatible by accepting a Model instance.

02/22/08 12:00:50 changed by msaelices

  • cc changed from elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com to elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es.

03/07/08 09:12:26 changed by brosner

  • version changed from SVN to newforms-admin.

03/07/08 09:18:52 changed by mtredinnick

Why has this been moved to newforms_admin? Generic views aren't used in admin are they? If not, then it's a purely trunk thing and we should avoid doing it on the branch.

03/07/08 09:28:00 changed by brosner

I may have got the wrong impression that newforms-admin was meant for all newforms conversions. Is that not true or is this an exception to that?

(follow-up: ↓ 18 ) 03/07/08 09:33:19 changed by mtredinnick

  • version changed from newforms-admin to SVN.

Newforms admin is for converting admin to use newforms. Like it says in the branch name.

This patch will be committed to trunk eventually, don't worry. But I, personally, haven't done it yet because of the massive backwards-incompatibility it introduces, making timing important. It should definitely be independent of newforms admin, though, so that people don't have unrelated upheavals going on at once.

(in reply to: ↑ 17 ) 03/07/08 10:57:16 changed by Karen Tracey <kmtracey@gmail.com>

Replying to mtredinnick:

Newforms admin is for converting admin to use newforms. Like it says in the branch name.

The question of the scope of the newforms-admin branch also came up when someone starting looking at converting auth to newforms. Russell's reply here:

http://groups.google.com/group/django-developers/msg/f5e0a3c5a227c123

may be where people are getting the idea that all remaining newforms conversions should be done first in the context of the newforms-admin branch. Not trying to say one way or the other where things should be done, just trying to point out where the confusion may be coming from.

04/16/08 15:39:03 changed by brosner

  • owner deleted.
  • status changed from assigned to new.

05/02/08 20:25:14 changed by Samuel Cormier-Iijima <sciyoshi@gmail.com>

  • cc changed from elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es to elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com.

05/11/08 09:01:25 changed by anonymous

  • cc changed from elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com to elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com.

06/09/08 01:03:55 changed by mir

  • cc changed from elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com to elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com, mir@noris.de.

06/09/08 20:09:20 changed by Jeff Forcier <jeff@bitprophet.org>

  • cc changed from elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com, mir@noris.de to elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com, mir@noris.de, jeff@bitprophet.org.

Pedantic note, should this ticket's description be updated to reflect the more, er, generic goal of having all generic views use newforms, not just create_update? Certainly it's now implied by VersionOneFeatures that this is "the" ticket for such things.

06/09/08 20:18:03 changed by brosner

The create_update views are the only ones that use forms. It would make sense that they would be the only ones :)

06/09/08 20:20:23 changed by Jeff Forcier <jeff@bitprophet.org>

That's a really good point, I've been thinking too much about generic views as a single package and that didn't really occur to me. I clearly need to avoid browsing Trac tickets after overly-long work days...:)

06/12/08 11:49:51 changed by programmerq

  • cc changed from elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com, mir@noris.de, jeff@bitprophet.org to elsdoerfer@gmail.com, hv@tbz-pariv.de, niels.busch@gmail.com, msaelices@yaco.es, sciyoshi@gmail.com, ganeshpulsars@gmail.com, mir@noris.de, jeff@bitprophet.org, jefferya@programmerq.net.

06/16/08 12:11:40 changed by jacob

  • milestone set to 1.0 alpha.

06/16/08 15:48:34 changed by gwilson

  • attachment 3639.diff added.

some updates to Brian's latest patch


Add/Change #3639 (use newforms in generic create_update view)




Change Properties
Action