somebody know how to use instance method in the validator_list of a
field in model? I can't get the "self".

class Category(models.Model):
    """ Inhert Category """

    title_en = models.CharField(maxlength=256, null=True)

    parent = models.ForeignKey('self', related_name="direct_children",
        null=True, blank=True, validator_list=[self.isValidParent]) #
we want the instance method here

    def isValidParent(self, field_data, all_data):
        if field_data in self.children_ids()
            raise validators.ValidationError("u can't set your children
as your parent, cause loop")


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to