diff -r 01b4ede45410 -r 7820036d6b68 django/core/management/validation.py
--- a/django/core/management/validation.py	Mon Sep 28 09:11:22 2009 +0930
+++ b/django/core/management/validation.py	Sat Sep 26 19:39:42 2009 +0000
@@ -22,7 +22,6 @@
     from django.db import models, connection
     from django.db.models.loading import get_app_errors
     from django.db.models.fields.related import RelatedObject
-    from django.core.exceptions import ValidationError
 
     e = ModelErrorCollection(outfile)
 
@@ -63,22 +62,6 @@
                             e.add(opts, '"%s": "choices" should be a sequence of two-tuples.' % f.name)
             if f.db_index not in (None, True, False):
                 e.add(opts, '"%s": "db_index" should be either None, True or False.' % f.name)
-            if f.constraint:
-                # This section seems somewhat verbose: I wonder if it can be simplified.
-                try:
-                    op, value = f.constraint.split()
-                except ValueError:
-                    e.add(opts, '"%s": "constraint" must be like "< value".' % f.name)
-                    continue
-                if op not in ("<",">","=","<=",">=","!="):
-                    e.add(opts, '"%s": "constraint" must have valid comparison operator.' % f.name)
-                try:
-                    value = f.to_python(value)
-                except ValidationError:
-                    if value in map(lambda x:x.name, opts.local_fields):
-                        e.add(opts, '"%s": "constraint" operand must not be another column name. Use a table-based constraint instead.' % f.name)
-                    else:
-                        e.add(opts, '"%s": "constraint" operand must be a valid value for this column.' % f.name)
 
             # Perform any backend-specific field validation.
             connection.validation.validate_field(e, opts, f)
@@ -237,30 +220,4 @@
                     if f not in opts.local_fields:
                         e.add(opts, '"unique_together" refers to %s. This is not in the same model as the unique_together statement.' % f.name)
 
-        # Check check_constraints
-        for cc in opts.check_constraints:
-            try:
-                fname1, op, fname2 = cc.split()
-            except ValueError:
-                e.add(opts, '"check_constraints" does not look like "column1 < column2". Check your syntax.')
-                continue
-            for field_name in (fname1, fname2):
-                try:
-                    f = opts.get_field(field_name)
-                except models.FieldDoesNotExist:
-                    e.add(opts, '"check_constraints" refers to "%s", a field that doesn\'t exist. Check your syntax.' % field_name)
-            if op not in ('<','>','=','<=','>=','!='):
-                e.add(opts, '"check_constraints" uses "%s", an operator that is unknown. Check your syntax.' % op)
-            try:
-                field1 = opts.get_field(fname1)
-                field2 = opts.get_field(fname2)
-                if type(field1) != type(field2):
-                    # This is probably the only part of this phase I am really not that happy with.
-                    # How do I find out if two types can be compared? How does SQL decide.
-                    e.add(opts, '"check_constraints" compares two columns that cannot be compared.')
-            except models.FieldDoesNotExist:
-                pass # This has been dealt with above.
-            if opts.abstract:
-                e.add(opts, 'Abstract models cannot be given "check_constraints" options. Or something.')
-
     return len(e.errors)
diff -r 01b4ede45410 -r 7820036d6b68 django/db/backends/creation.py
--- a/django/db/backends/creation.py	Mon Sep 28 09:11:22 2009 +0930
+++ b/django/db/backends/creation.py	Sat Sep 26 19:39:42 2009 +0000
@@ -62,9 +62,6 @@
                 field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
             elif f.unique:
                 field_output.append(style.SQL_KEYWORD('UNIQUE'))
-            if f.constraint:
-                field_output.append(style.SQL_KEYWORD('CHECK') + " (%s %s)" % \
-                    (style.SQL_FIELD(qn(f.column)), f.constraint))
             if tablespace and f.unique:
                 # We must specify the index tablespace inline, because we
                 # won't be generating a CREATE INDEX statement for this field.
@@ -82,16 +79,6 @@
         for field_constraints in opts.unique_together:
             table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \
                 ", ".join([style.SQL_FIELD(qn(opts.get_field(f).column)) for f in field_constraints]))
-        for check_constraint in opts.check_constraints:
-            # Turn 'start < finish' into 'start_finish'
-            # This assumes that only one constraint per pair of columns
-            constraint_name = "_".join(check_constraint.split()[0:3:2])
-            table_output.append("%s %s %s (%s)" % (
-                style.SQL_KEYWORD('CONSTRAINT'),
-                style.SQL_TABLE(qn(opts.db_table + '_' + constraint_name)),
-                style.SQL_KEYWORD('CHECK'),
-                check_constraint
-            ))
 
         full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + style.SQL_TABLE(qn(opts.db_table)) + ' (']
         for i, line in enumerate(table_output): # Combine and add commas.
diff -r 01b4ede45410 -r 7820036d6b68 django/db/models/fields/__init__.py
--- a/django/db/models/fields/__init__.py	Mon Sep 28 09:11:22 2009 +0930
+++ b/django/db/models/fields/__init__.py	Sat Sep 26 19:39:42 2009 +0000
@@ -64,7 +64,7 @@
             db_index=False, rel=None, default=NOT_PROVIDED, editable=True,
             serialize=True, unique_for_date=None, unique_for_month=None,
             unique_for_year=None, choices=None, help_text='', db_column=None,
-            db_tablespace=None, auto_created=False, constraint=None):
+            db_tablespace=None, auto_created=False):
         self.name = name
         self.verbose_name = verbose_name
         self.primary_key = primary_key
@@ -85,7 +85,6 @@
         self.db_column = db_column
         self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
         self.auto_created = auto_created
-        self.constraint = constraint
 
         # Set db_index to True if the field has a relationship and doesn't explicitly set db_index.
         self.db_index = db_index
diff -r 01b4ede45410 -r 7820036d6b68 django/db/models/options.py
--- a/django/db/models/options.py	Mon Sep 28 09:11:22 2009 +0930
+++ b/django/db/models/options.py	Sat Sep 26 19:39:42 2009 +0000
@@ -21,7 +21,7 @@
 DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
                  'unique_together', 'permissions', 'get_latest_by',
                  'order_with_respect_to', 'app_label', 'db_tablespace',
-                 'abstract', 'managed', 'proxy', 'check_constraints')
+                 'abstract', 'managed', 'proxy')
 
 class Options(object):
     def __init__(self, meta, app_label=None):
@@ -32,7 +32,6 @@
         self.db_table = ''
         self.ordering = []
         self.unique_together =  []
-        self.check_constraints = []
         self.permissions =  []
         self.object_name, self.app_label = None, app_label
         self.get_latest_by = None
diff -r 01b4ede45410 -r 7820036d6b68 django/forms/models.py
--- a/django/forms/models.py	Mon Sep 28 09:11:22 2009 +0930
+++ b/django/forms/models.py	Sat Sep 26 19:39:42 2009 +0000
@@ -243,11 +243,6 @@
         bad_fields.union(field_errors)
         form_errors.extend(global_errors)
 
-        check_constraints, column_check_constraints = self._get_check_constraints()
-        field_errors, global_errors = self._perform_check_constraints(check_constraints, column_check_constraints)
-        bad_fields.union(field_errors)
-        form_errors.extend(global_errors)
-
         for field_name in bad_fields:
             del self.cleaned_data[field_name]
         if form_errors:
@@ -298,44 +293,6 @@
                 date_checks.append(('month', name, f.unique_for_month))
         return unique_checks, date_checks
 
-    def _get_check_constraints(self):
-        from django.db.models.fields import FieldDoesNotExist, Field as ModelField
-        
-        # Find all of the constraints that need to be applied to this model
-        # Since a comparison of NULL with any value will return NULL, and
-        # a constraint will 'succeed' if it return either NULL or TRUE, then
-        # we can safely ignore any constraints with values that are None.
-        # We can also ignore any fields that did not validate, as they will
-        # have the error message from the invalid data.
-        
-        column_check_constraints = []
-        check_constraints = []
-        
-        for check_constraint in self.instance._meta.check_constraints[:]:
-            f1, op, f2 = check_constraint.split()
-            if self.cleaned_data.get(f1) is None or \
-               self.cleaned_data.get(f2) is None:
-                continue
-            check_constraints.append(check_constraint)
-            
-        # Also need to append individual column check constraints.
-        # Skip any fields that did not validate.
-        for name in self.fields:
-            try:
-                f = self.instance._meta.get_field_by_name(name)[0]
-            except FieldDoesNotExist:
-                # This is an extra field that's not on the ModelForm, ignore it
-                continue
-            if not isinstance(f, ModelField):
-                # This is an accessor with the same name as a field?
-                # Ignore
-                continue
-            if self.cleaned_data.get(name) is None:
-                continue
-            if f.constraint:
-               column_check_constraints.append((name, f.constraint))
-                
-        return check_constraints, column_check_constraints
 
     def _perform_unique_checks(self, unique_checks):
         bad_fields = set()
@@ -406,48 +363,6 @@
                 bad_fields.add(field)
         return bad_fields, []
 
-    def _perform_check_constraints(self, check_constraints, column_check_constraints):
-        bad_fields = set()
-        form_errors = []
-        
-        def _test(value1, op, value2):
-            # I'd love to see a better way to do this, but since these are
-            # statements, I'm not sure how to.  Moved into this inner func
-            # as we use it in two places.
-            if op == "<":
-                return value1 < value2
-            if op == ">":
-                return value1 > value2
-            if op == "=":
-                return value1 == value2
-            if op == "<=":
-                return value1 <= value2
-            if op == ">=":
-                return value1 >= value2
-            if op == "!=":
-                return value1 != value2
-            return False
-            
-        for field, tester in column_check_constraints:
-            value = self.cleaned_data.get(field)
-            op, other = tester.split()
-            # Convert the comparison value into a python object as parsed by
-            # this field.
-            other = self.instance._meta.get_field_by_name(field)[0].to_python(other)
-            if not _test(value, op, other):
-                self._errors[field] = ErrorList(["Invalid data for %s. Must be %s" % (field, tester)])
-                bad_fields.add(field)
-        
-        for constraint in check_constraints:
-            field_name1, op, field_name2 = constraint.split()
-            value1 = self.cleaned_data.get(field_name1)
-            value2 = self.cleaned_data.get(field_name2)
-            
-            if not _test(value1, op, value2):
-                form_errors.append("Invalid data. Does not satisfy " + constraint)
-                
-        return bad_fields, form_errors
-
     def date_error_message(self, lookup_type, field, unique_for):
         return _(u"%(field_name)s must be unique for %(date_field)s %(lookup)s.") % {
             'field_name': unicode(self.fields[field].label),
diff -r 01b4ede45410 -r 7820036d6b68 tests/modeltests/check_constraints/__init__.py
--- a/tests/modeltests/check_constraints/__init__.py	Mon Sep 28 09:11:22 2009 +0930
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-
diff -r 01b4ede45410 -r 7820036d6b68 tests/modeltests/check_constraints/models.py
--- a/tests/modeltests/check_constraints/models.py	Mon Sep 28 09:11:22 2009 +0930
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-
diff -r 01b4ede45410 -r 7820036d6b68 tests/modeltests/invalid_models/models.py
--- a/tests/modeltests/invalid_models/models.py	Mon Sep 28 09:11:22 2009 +0930
+++ b/tests/modeltests/invalid_models/models.py	Sat Sep 26 19:39:42 2009 +0000
@@ -182,34 +182,6 @@
     """ Model to test for unique ManyToManyFields, which are invalid. """
     unique_people = models.ManyToManyField( Person, unique=True )
 
-class Constraints(models.Model):
-    """ Model to test for invalid constraints. 
-    Do I have too many tests here?"""
-    int1 = models.IntegerField( constraint="<" )
-    int2 = models.IntegerField( constraint="< a" )
-    int3 = models.IntegerField( constraint="< int2" )
-    int4 = models.IntegerField( constraint="a 5" )
-    int5 = models.IntegerField( constraint="1 <" )
-    int6 = models.IntegerField( constraint="< 3 a" )
-    int7 = models.IntegerField( constraint="< 5.7" )
-    int8 = models.IntegerField( constraint=">> 5" )
-    date1 = models.DateField( constraint="> 2006-60-30" )
-    time1 = models.TimeField( constraint="!= 66:66" )
-    class Meta:
-        check_constraints = (
-            "int1>int2",
-            "int6 > int9",
-            "int1 e int2",
-            "date1 < int2",
-        )
-
-class AbstractConstraints(models.Model):
-    int1 = models.IntegerField()
-    int2 = models.IntegerField()
-    class Meta:
-        abstract = True
-        check_constraints = ('int1 < int2',)
-
 model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "max_length" attribute.
 invalid_models.fielderrors: "decimalfield": DecimalFields require a "decimal_places" attribute.
 invalid_models.fielderrors: "decimalfield": DecimalFields require a "max_digits" attribute.
@@ -306,19 +278,4 @@
 invalid_models.abstractrelationmodel: 'fk1' has a relation with model AbstractModel, which has either not been installed or is abstract.
 invalid_models.abstractrelationmodel: 'fk2' has an m2m relation with model AbstractModel, which has either not been installed or is abstract.
 invalid_models.uniquem2m: ManyToManyFields cannot be unique.  Remove the unique argument on 'unique_people'.
-invalid_models.constraints: "int1": "constraint" must be like "< value".
-invalid_models.constraints: "int2": "constraint" operand must be a valid value for this column.
-invalid_models.constraints: "int3": "constraint" operand must not be another column name. Use a table-based constraint instead.
-invalid_models.constraints: "int4": "constraint" must have valid comparison operator.
-invalid_models.constraints: "int5": "constraint" must have valid comparison operator.
-invalid_models.constraints: "int5": "constraint" operand must be a valid value for this column.
-invalid_models.constraints: "int6": "constraint" must be like "< value".
-invalid_models.constraints: "int7": "constraint" operand must be a valid value for this column.
-invalid_models.constraints: "int8": "constraint" must have valid comparison operator.
-invalid_models.constraints: "date1": "constraint" operand must be a valid value for this column.
-invalid_models.constraints: "time1": "constraint" operand must be a valid value for this column.
-invalid_models.constraints: "check_constraints" does not look like "column1 < column2". Check your syntax.
-invalid_models.constraints: "check_constraints" refers to "int9", a field that doesn't exist. Check your syntax.
-invalid_models.constraints: "check_constraints" uses "e", an operator that is unknown. Check your syntax.
-invalid_models.constraints: "check_constraints" compares two columns that cannot be compared.
 """
