Hmm,

I wrote this in my models.py. Errors rased are just for debugging.

class HasUniquePath(object):
   def __init__(self, cat_obj, error_message=gettext_lazy("No unique
path!")):
      self.cur_cat = cat_obj
      self.error_message = error_message
      self.always_test = True

   def __call__(self, field_data, all_data):
      if not field_data:
         # check for unique foldername
         folder = all_data.get('folder')
         raise validators.ValidationError("Only a folder %s no path") %
folder
      else:
         parent = field_data
         folder = all_data.get('folder')
         raise validators.ValidationError("A folder %s and a path %s")
% (folder, parent)

class Testcat(models.Model):
   title = models.CharField()
   folder = models.SlugField(prepopulate_from=('title',))
   parent = models.ForeignKey('self', blank=True, null=True,
related_name='child_set', validator_list=[HasUniquePath(self)])

Of course this wil not work because class "HasUniquePath" isn't a
manupulator.
I dont know however how to extend the object's manipulators.

Can yoy please give me a hint?


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