Re: admin > custom error message

2007-01-11 Thread Rob Slotboom
Hi James et all, Because of what I want it isn't possible to just rely on a validator, I need a manipulator to get a request object. The manipulator only has to add an extra validator to one field. This validator validates using the database. No custom form is needed. The manipulator will be use

Re: admin > custom error message

2007-01-09 Thread Robert Slotboom
Hi James, > You don't need to write a manipulator; just write a validator > function, and put it in the validator_list for that field on the > model. Django will handle calling the validator for you any time one > of the "automatic" manipulators (e.g., in the admin) gets used. > Ok I got it work

Re: admin > custom error message

2007-01-09 Thread James Bennett
On 1/9/07, Rob Slotboom <[EMAIL PROTECTED]> wrote: > Of course this wil not work because class "HasUniquePath" isn't a > manupulator. > I dont know however how to extend the object's manipulators. You don't need to write a manipulator; just write a validator function, and put it in the validator_

Re: admin > custom error message

2007-01-09 Thread Rob Slotboom
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__

Re: admin > custom error message

2007-01-09 Thread Rob Slotboom
Thanks James, I'll try this one def IsUniqueForPath(): ... class Category(models.Model): ... parent = models.ForeignKey('self', blank=True, null=True, related_name='child_set', validator_list=[IsUniqueForPath]) --~--~-~--~~~---~--~~ You received this message

Re: admin > custom error message

2007-01-09 Thread Rob Slotboom
Hi James, When I write a custom validator like: isValidCategory() I need a manipulator, validator and a form. Is there a way to use the 'current' ones and to expand these or do I need to create them from scratch? --~--~-~--~~~---~--~~ You received this message b

Re: admin > custom error message

2007-01-08 Thread James Bennett
On 1/8/07, Rob Slotboom <[EMAIL PROTECTED]> wrote: Given this save function in one of my models, I want to display an error message in admin instead of a errorpage. This code needs to be a custom validator attached to the field, rather than being in the 'save' method; once you're at the point

admin > custom error message

2007-01-08 Thread Rob Slotboom
Given this save function in one of my models, I want to display an error message in admin instead of a errorpage. def save(self): try: cur_id = int(self.id) except: cur_id = 0 p_list = self._recurse_for_parents(self) cats = Category.objects.filter(folder__ex