Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#1164 closed enhancement (duplicate)

[patch] context processors for fields and manipulators

Reported by: jkocherhans <jkocherhans@…> Owned by: adrian
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: UI/UX:

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@…> 10 years ago.

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by jkocherhans <jkocherhans@…>

comment:1 Changed 10 years ago by hugo

  • Resolution set to duplicate
  • Status changed from new to closed

superseeded by #1268

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