Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#1563 closed enhancement (wontfix)

[patch] generic views should accept `manipulator` parameter

Reported by: mir@… Owned by: Jacob
Component: Generic views Version: magic-removal
Severity: normal Keywords: manipulator
Cc: mir@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'd like to be able to pass a Manipulator object into the generic views. This allows a very nice code pattern:

  • the view function handles fetching the required data and doing sanity checks, creates a manipulator and calls the generic view
  • the generic view handles all the ugly http and form processing, eventually calling the manipulator
  • the manipulator does all the customized field stuff (additional/modified fields)

Sometimes this needs to pass special parameters to the initializer of the manipulator (e.g., a ChangeManipulator) must prepopulate default values dependent on the some other parameter of the view).

I think this makes a great general pattern. I'm willing to put something up in the wiki if you're interested.

Attachments (2)

generic-views-manipulator.diff (1.9 KB ) - added by mir@… 18 years ago.
generic-views-manipulator.2.diff (1.8 KB ) - added by mir@… 18 years ago.

Download all attachments as: .zip

Change History (11)

by mir@…, 18 years ago

by mir@…, 18 years ago

comment:1 by mir@…, 18 years ago

Removed first two lines which have confused trac

comment:3 by odonian@…, 18 years ago

Just another Django user who'd love to see this (seemingly small) change implemented; it would enhance and increase the use of generic views by quite a bit. My use case has a model with a field called modifiedBy, which points to the logged-in user. Currently I have to write a separate view and manipulator to take care of filling in that data, when it's just a slightly modified manipulator that's needed.

comment:4 by Adrian Holovaty, 18 years ago

Resolution: wontfix
Status: newclosed

Because manipulators are going away, I don't think we should do this.

comment:5 by anonymous, 18 years ago

Resolution: wontfix
Status: closedreopened

Hmm, are you talking also about _custom_ manipulators, or only automatic manipulators?

This usage is specific for custom manipulators, and I can't imagine you really want to remove custom manipulators.

comment:6 by Jacob, 18 years ago

Resolution: wontfix
Status: reopenedclosed

Reclosing -- see Adrian's words.

comment:7 by mir@…, 18 years ago

Resolution: wontfix
Status: closedreopened

I assume that you went over this too fast. I asked a direct question to understand what you are doing:

Hmm, are you talking also about _custom_ manipulators, or only automatic manipulators?

This has not been answered, so I don't understand why you closed the ticket.

I don't want to play ping-pong or be obnoxious. If you really didn't want to answer this question, please state so that I know this has not been by accident.

Michael

comment:8 by Jacob, 18 years ago

Resolution: wontfix
Status: reopenedclosed

Since manipulators won't be used by generic views in the near future, this would mean the proposed manipulator argument would cause pretty different behavior. I'm marking this wontfix again.

comment:9 by mir@…, 18 years ago

Thanks, Jacob.

Please understand that this is really valuable information for me. Now I know that I should simply copy the generic views that I use all the time and just change it, instead of patching it in the django source tree. That's also why it is helpful to see your tickets rejected rather than having your change in limbo, not knowing what will happen, maybe for months.

Note: See TracTickets for help on using tickets.
Back to Top