app/django/db/backends/postgresql/creation.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Sat, 13 Sep 2008 22:00:51 +0000
changeset 141 e120c24b89e2
parent 54 03e267d67478
child 323 ff1a9aa48cfd
permissions -rw-r--r--
Added Melange front page edit view where you can change title, content, feed url. Created SiteSettings and Document models and some logic for them. Added isFeedURLValid function in soc/logic/feed.py. Created some functions for handling datastore updates of different kinds of Models (soc/logic/model.py). Fixed some typos and too long lines of code. Patch by: Pawel Solyga Review by: to-be-reviewed

# This dictionary maps Field objects to their associated PostgreSQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict__ before being output.
# If a column type is set to None, it won't be included in the output.
DATA_TYPES = {
    'AutoField':         'serial',
    'BooleanField':      'boolean',
    'CharField':         'varchar(%(max_length)s)',
    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
    'DateField':         'date',
    'DateTimeField':     'timestamp with time zone',
    'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
    'FileField':         'varchar(%(max_length)s)',
    'FilePathField':     'varchar(%(max_length)s)',
    'FloatField':        'double precision',
    'ImageField':        'varchar(%(max_length)s)',
    'IntegerField':      'integer',
    'IPAddressField':    'inet',
    'NullBooleanField':  'boolean',
    'OneToOneField':     'integer',
    'PhoneNumberField':  'varchar(20)',
    'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)',
    'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)',
    'SlugField':         'varchar(%(max_length)s)',
    'SmallIntegerField': 'smallint',
    'TextField':         'text',
    'TimeField':         'time',
    'USStateField':      'varchar(2)',
}