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 not know is how I can hook up this validator such > that it informs the user that the file is already uploaded.
The pre_save signal does not provide any way to "veto" the save that is about to happen, so it's not useful for validation that needs to abort the save and alert the user. For this you'll need to write your validation in the usual way in a Form class [1]. If you're doing the uploading in the admin, you'll need to hook in a custom ModelForm there.[2] Carl [1] http://docs.djangoproject.com/en/dev/ref/forms/validation/ [2] http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

