Ticket #9862: 9862.diff

File 9862.diff, 1.3 KB (added by Erin Kelly, 15 years ago)
  • django/db/backends/creation.py

     
    4747            # Make the definition (e.g. 'foo VARCHAR(30)') for this field.
    4848            field_output = [style.SQL_FIELD(qn(f.column)),
    4949                style.SQL_COLTYPE(col_type)]
    50             field_output.append(style.SQL_KEYWORD('%sNULL' % (not f.null and 'NOT ' or '')))
     50            if not f.null:
     51                field_output.append(style.SQL_KEYWORD('NOT NULL'))
    5152            if f.primary_key:
    5253                field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
    5354            elif f.unique:
     
    6566            table_output.append(' '.join(field_output))
    6667        if opts.order_with_respect_to:
    6768            table_output.append(style.SQL_FIELD(qn('_order')) + ' ' + \
    68                 style.SQL_COLTYPE(models.IntegerField().db_type()) + ' ' + \
    69                 style.SQL_KEYWORD('NULL'))
     69                style.SQL_COLTYPE(models.IntegerField().db_type()))
    7070        for field_constraints in opts.unique_together:
    7171            table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \
    7272                ", ".join([style.SQL_FIELD(qn(opts.get_field(f).column)) for f in field_constraints]))
Back to Top