Default to null=True for Django Fields.

Fixes issue #161.

Reviewed in http://codereview.appspot.com/6448098/
This commit is contained in:
Joe Gregorio
2012-08-01 14:23:21 -04:00
parent 20b54fbefa
commit 15423ec74d
2 changed files with 18 additions and 9 deletions

View File

@@ -31,6 +31,11 @@ class CredentialsField(models.Field):
__metaclass__ = models.SubfieldBase __metaclass__ = models.SubfieldBase
def __init__(self, *args, **kwargs):
if 'null' not in kwargs:
kwargs['null'] = True
super(CredentialsField, self).__init__(*args, **kwargs)
def get_internal_type(self): def get_internal_type(self):
return "TextField" return "TextField"
@@ -51,6 +56,11 @@ class FlowField(models.Field):
__metaclass__ = models.SubfieldBase __metaclass__ = models.SubfieldBase
def __init__(self, *args, **kwargs):
if 'null' not in kwargs:
kwargs['null'] = True
super(FlowField, self).__init__(*args, **kwargs)
def get_internal_type(self): def get_internal_type(self):
return "TextField" return "TextField"

View File

@@ -10,12 +10,12 @@ ADMINS = (
MANAGERS = ADMINS MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' DATABASES = {
DATABASE_NAME = 'database.sqlite3' 'default': {
DATABASE_USER = '' 'ENGINE': 'django.db.backends.sqlite3',
DATABASE_PASSWORD = '' 'NAME': 'mydatabase'
DATABASE_HOST = '' }
DATABASE_PORT = '' }
# Local time zone for this installation. Choices can be found here: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -53,9 +53,8 @@ SECRET_KEY = '_=9hq-$t_uv1ckf&s!y2$9g$1dm*6p1cl%*!^mg=7gr)!zj32d'
# List of callables that know how to import templates from various sources. # List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.load_template_source', 'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.load_template_source',
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (