app/django/db/backends/sqlite3/creation.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Fri, 12 Sep 2008 16:33:04 +0000
changeset 135 a7ccde9d9eed
parent 54 03e267d67478
child 323 ff1a9aa48cfd
permissions -rw-r--r--
Fixed one typo in response_helpers which caused is_admin context variable not to work correctly. Created new checkLinkNameForId function that checks if link_name is correct when creating new user and modifying existing one. This is now used for validation instead of doesLinkNameBelongToId in UserForm clean_link_name function. The previous validation function didn't allow to create new users and modify linkname of existing ones. Additionally I created new doesLinkNameExist helper function.

# SQLite doesn't actually support most of these types, but it "does the right
# thing" given more verbose field definitions, so leave them as is so that
# schema inspection is more useful.
DATA_TYPES = {
    'AutoField':                    'integer',
    'BooleanField':                 'bool',
    'CharField':                    'varchar(%(max_length)s)',
    'CommaSeparatedIntegerField':   'varchar(%(max_length)s)',
    'DateField':                    'date',
    'DateTimeField':                'datetime',
    'DecimalField':                 'decimal',
    'FileField':                    'varchar(%(max_length)s)',
    'FilePathField':                'varchar(%(max_length)s)',
    'FloatField':                   'real',
    'ImageField':                   'varchar(%(max_length)s)',
    'IntegerField':                 'integer',
    'IPAddressField':               'char(15)',
    'NullBooleanField':             'bool',
    'OneToOneField':                'integer',
    'PhoneNumberField':             'varchar(20)',
    'PositiveIntegerField':         'integer unsigned',
    'PositiveSmallIntegerField':    'smallint unsigned',
    'SlugField':                    'varchar(%(max_length)s)',
    'SmallIntegerField':            'smallint',
    'TextField':                    'text',
    'TimeField':                    'time',
    'USStateField':                 'varchar(2)',
}