Hello,
I'm writing my own validator based on shipped with django and wondering
how get validated object.id field ?

Following function does not return it ..it should raised error with
message contained keys from validated object. It does but there is no
'id' field.

class ifFieldExistIsUnique(object):
    def __init__(self,checked_value, error_message=gettext_lazy("Please
enter something for at least one field.")):
        self.other, self.error_message = checked_value, error_message
        self.always_test = True

    def __call__(self,field_data,all_data):
        from wtm.k.models import Customer
        self.field = all_data.get(self.other)
        lookup={self.other:self.field}
        if len(self.field) != 0:

#sres=Customer.objects.exclude(id=all_data.get(id)).filter(**lookup)
            raise validators.ValidationError, str(all_data.keys())

How pass id to valitador ?


--~--~---------~--~----~------------~-------~--~----~
 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to