Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1164 closed enhancement (duplicate)

[patch] context processors for fields and manipulators

Reported by: jkocherhans <jkocherhans@…> Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The manupulator and the model currently have no way to acccess anything in the request. This makes it impossible (using admin or generic views) to do something like an auto-filled author field where the author is the current user. This patch creates a new type of context that is passed in to a manipulator's __init__ method. The context is normally a ManipulatorContext object, but can be any dict. By default, ManipulatorContext gets a list of context processors by calling f.get_context_processors() on each field in the model. This context object is passed to get_manipulator_new_data when an object is saved via the manipulator.

This could probably be used for callable choices and callable defaults for fields. Also, this should make everything in #1132 possible.

Attachments (1)

manipulator_contexts.diff (14.2 KB ) - added by jkocherhans <jkocherhans@…> 19 years ago.

Download all attachments as: .zip

Change History (2)

by jkocherhans <jkocherhans@…>, 19 years ago

Attachment: manipulator_contexts.diff added

comment:1 by hugo, 19 years ago

Resolution: duplicate
Status: newclosed

superseeded by #1268

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