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
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
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_
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__
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
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
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
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
8 matches
Mail list logo