[patch] Manipulator-aware admin validators are impossible
|Reported by:||Tom Tobin <korpios@…>||Owned by:||adrian|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Since magic-removal was merged, there has been no straightforward way to create a validator with the manipulator available to it (see this post on django-users for an example of how it might be done). Furthermore, it has been outright impossible to create such a validator for use in the admin; such validators were possible in pre-MR by prefixing the validator name with manipulator_validate.
The attached patch aims to restore such functionality by means of a simple, backwards-compatible API change: if the validator takes three arguments, rather than the standard two (i.e., field_data and all_data), the manipulator will be passed in as the first argument. The patch uses currying to accomplish this, and accounts for all the various types of callables that might be used (methods, callable class instances, etc.).
Change History (4)
Changed 9 years ago by Tom Tobin <korpios@…>
comment:2 Changed 8 years ago by korpios
- Reporter changed from Tom Tobin <korpios@…> to Tom Tobin <korpios@…>