On Sep 14, 3:03 pm, Mike H <[EMAIL PROTECTED]> wrote: > Hi all, > > I've have a few models that need a bit more complex validation than the > Validators can handle. (They have a start and end date and need to check > in the database that no other record has an overlapping start / end > date.) The validation I need to do would be easy to do if the validators > accepted the primary key of the model they were validating for, if they > were validating for an existing instance. But as far as I can see, they > don't.
Why don't you make both your start date and end date primary keys? Or you could probably try Django Check Constraints http://code.google.com/p/django-check-constraints. By using Django Check Constraints you could also make sure that start date is less than the end date and also give a range for start date. Check the Features page for more details http://code.google.com/p/django-check-constraints/wiki/Features Hope it helps. Cheers Thejaswi Puthraya --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
