Opened 18 years ago
Closed 17 years ago
#4236 closed (duplicate)
newforms in create_update views + several enhancements
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Generic views | Version: | dev |
Severity: | Keywords: | newforms | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
this patch is similar to #3639, but comes with several enhancements
there are several more view arguments in this patch:
not_required_fields=None - list of field names; sets form.fields[field].required=False
hidden_fields=None - dictionary of fieldnames and values; these fields are supposed to be constants (they are not overwritten by post data)
default_data=None - dictionary of default values; used when creating new form instance
choices=None - list of tuples; allows value filtering of choice fields
Attachments (1)
Change History (5)
by , 18 years ago
Attachment: | create_update_newforms.diff added |
---|
follow-up: 2 comment:1 by , 18 years ago
comment:2 by , 18 years ago
Replying to mtredinnick:
As usual, combining two features in one ticket reports leads to problem. It's difficult to evaluate and discuss the changes in isolation. So let's make this ticket about the new features you wish to add to a couple of generic views and keep #3639 (which is still open, so we don't need dupes of that ticket) to be about the port to newforms.
You are right, I should have splitted the patch into two ones, I keep in mind for the next time.
Are there problems with the patch in #3639 (aside from the one I mention in the last comment over there)? Is so, an updated patch to that ticket would be reasonable (attached to #3639). You are introducing some backwards incompatible changes in this patch: the follow attribute goes away. Will we miss that behaviour?
My patch is only slightly better than #3639 in my opinion.
This is the list of important differences when comparing to the #3639 patch:
- if extra_context is None: extra_context = {} is replaced by direct condition if extra_context:
- if request.POST: is replaced by if request.method == 'POST'
- follow attribute is dropped (see below)
- code cleanup, more comments
Rest of the changes were supposed to add new features.
The follow attribute seems to be an oldforms feature that (probably) should dropped.
Please notice, that this attribute still exists in #3639 but isn't used any more.
Do you think that is reasonable to apply the changes I mentioned above to the #3639 patch?
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:4 by , 17 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This ticket is adding too much functionality that is not needed in the generic views. All of the proposed functionality can be easily accomplish with using the newforms customization tricks. I have attached a patch to #3639 that allows for form
and
formfield_callback
overrides where you can make fields hidden, not required, default data, etc... Closing this as it is not needed any longer and half of this ticket is a duplicate with #3639.
As usual, combining two features in one ticket reports leads to problem. It's difficult to evaluate and discuss the changes in isolation. So let's make this ticket about the new features you wish to add to a couple of generic views and keep #3639 (which is still open, so we don't need dupes of that ticket) to be about the port to newforms.
Are there problems with the patch in #3639 (aside from the one I mention in the last comment over there)? Is so, an updated patch to that ticket would be reasonable (attached to #3639). You are introducing some backwards incompatible changes in this patch: the follow attribute goes away. Will we miss that behaviour?
After applying whichever patch looks best from #3639, then we can look at the new features proposed here.