Django

Code

Ticket #1164 (closed: duplicate)

Opened 3 years ago

Last modified 2 years ago

[patch] context processors for fields and manipulators

Reported by: jkocherhans <jkocherhans@mac.com> Assigned to: adrian
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

manipulator_contexts.diff (14.2 kB) - added by jkocherhans <jkocherhans@mac.com> on 01/04/06 11:38:23.

Change History

01/04/06 11:38:23 changed by jkocherhans <jkocherhans@mac.com>

  • attachment manipulator_contexts.diff added.

01/24/06 02:18:25 changed by hugo

  • status changed from new to closed.
  • resolution set to duplicate.

superseeded by #1268


Add/Change #1164 ([patch] context processors for fields and manipulators)




Change Properties
Action