Re: check if file exists before uploading | adding a validator to a field

2008-10-09 Thread jelle
Many thanks Carl, that was most helpful! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send em

Re: check if file exists before uploading | adding a validator to a field

2008-10-06 Thread Carl Meyer
Hi jelle, On Oct 6, 5:34 am, jelle <[EMAIL PROTECTED]> wrote: > Now, what I'd like to do is to write a validator which will check if a > ( renamed ) file is already existing. Writing the validator itself > isnt too hard; I can just use pre_save.connect and call a function > from here. What I do n

check if file exists before uploading | adding a validator to a field

2008-10-06 Thread jelle
Hi, I'm working on an asset managment app, that will rename uploaded files according to a specified nomenclature. Now, what I'd like to do is to write a validator which will check if a ( renamed ) file is already existing. Writing the validator itself isnt too hard; I can just use pre_save.connec

Re: adding a validator

2006-04-03 Thread layik
I have also read all posts related to a validator here --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from thi

adding a validator

2006-04-03 Thread layik
I have read the validator documents please help me with steps of adding a validator to my FileField. where do I start? I dont know where to put somthing similar to this example into my class, http://www.djangoproject.com/documentation/forms/#Validators and where to put each bit! thanks

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