On Oct 14, 12:55 am, Geobase Isoscale <isosc...@gmail.com> wrote: > Hi All, > > I'm working with PostgreSQL database. > I wonder how Django handles Check Constraints both (range and value based). > To ensure integrity of data in the database as postresql does. > > How are they implemented in models and views. >
Django does not have the ability to add in check constraints into the postgresql database for you from your models, nor does it have the ability to easily mark columns or tables as having said constraints. I did raise a ticket about this, and create a patch (which I am using), but it is specific to postgresql, and limited to simple constraints. The usual way is to have the constraints applied in the forms, using the clean_column() and clean() methods. I prefer having them at both the database and model level, however. You can see the thread in django-developers (http:// groups.google.com.au/group/django-developers/browse_thread/thread/ 38937992972c7808/ef9783182671b348?lnk=gst&q=check +constraint#ef9783182671b348), and the ticket (http:// code.djangoproject.com/ticket/11964). 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 -~----------~----~----~----~------~----~------~--~---