On Oct 14, 9:57 am, Christophe Pettus <x...@thebuild.com> wrote: > On Oct 13, 2009, at 4:46 PM, Geobase Isoscale wrote: > > > Do your mean that its not possible for Django to recognize > > postgreSQL defined Check constraints when data is entered in the Form? > > That's correct. CHECK constraints on the PostgreSQL database are not > automatically enforced at the form level in Django. You'll need to > check and enforce those separately in your Django code.
The database will always prevent data that breaks constraints being committed, however. My patch changes the validation process so that it will test those constraints automatically, and alert you in the manner expected (raising ValidationError, and in the admin, putting those lovely red boxes around the field). I also hook into the creation process, and create the constraints in the table/column definition. Otherwise, you would need to add in the constraints afterwards. This isn't that relevant if you are not using the syncdb command, for instance. As for how to patch your installation: I use a mercurial mirror of django, which I patch against. There is no reason you could not just patch the installed version, by manually looking at the diffs in the patch, and applying those to the relevant files. I was going to extend the patch, but my use of check constraints at this stage is limited to strictly simple cases (start < finish, for instance). You may be able to extend it, and I am happy to help test them, but I haven't really looked at geodjango, so I don't know much about it. Matt. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---