Re: Adding a validator a custom manipulator

2005-11-30 Thread bsoltani
yes, it worked. I hadn't seen that part of the model documentation about the automatically called validators. thanks!

Re: Adding a validator a custom manipulator

2005-11-30 Thread oggie rob
Babak, It shouldn't matter. Take a look at django.core.meta.__init__ manipulator_methods[k[len(MANIPULATOR_FUNCTIONS_PREFIX):]] = v and _reassign_globals(manipulator_methods, new_mod, new_mod.__dict__['AddManipulator']) _reassign_globals(manipulator_methods, new_mod, new_mod.__dict__['ChangeManip

Re: Adding a validator a custom manipulator

2005-11-30 Thread bsoltani
rob, well, i'm doing this in a custom form/view. It's not being done by the site administrator.

Re: Adding a validator a custom manipulator

2005-11-30 Thread oggie rob
Wait, what? I don't think you need to say object.AddManipulator() Just put that method in your model, and go to the admin interface. It should work for both adding and changing an object in the model. -rob

Re: Adding a validator a custom manipulator

2005-11-30 Thread oggie rob
Yes

Re: Adding a validator a custom manipulator

2005-11-30 Thread bsoltani
so: if I add the above method to my model, it is going to get called automatically when i do object.AddManipulator()?

Re: Adding a validator a custom manipulator

2005-11-30 Thread bsoltani
I think I get what your saying... I'm going to check it out and see if it works. The "tech support" here is amazing. You are you guys aren't outsourcing to India?

Re: Adding a validator a custom manipulator

2005-11-30 Thread oggie rob
Hi Babak, I think you can have the cake. Don't mess with CustomManipulators, just add this method into your model: def _manipulator_validate_filefield(self, field_data, all_data): # if file is not the right type #raise validators.ValidationError, 'Please enter a valid file type'

Re: Adding a validator a custom manipulator

2005-11-30 Thread Adrian Holovaty
On 11/30/05, bsoltani <[EMAIL PROTECTED]> wrote: > I'm trying to validate a file upload field to make sure that the users > uploaded file is of a specific type. I know this can be done with a > custom manipulator (and in turn a custom validator). However, I still > want to be able to use the def

Adding a validator a custom manipulator

2005-11-30 Thread bsoltani
I'm trying to validate a file upload field to make sure that the users uploaded file is of a specific type. I know this can be done with a custom manipulator (and in turn a custom validator). However, I still want to be able to use the default manipulator for my object for the rest of the parts