Commits

Anonymous committed 6750308

Fixed #1477: URLFields now accept a maxlength parameter. Thanks, Matt Croydon.

  • Participants
  • Parent commits c1d6cf8

Comments (0)

Files changed (6)

File django/db/backends/ado_mssql/creation.py

     'SmallIntegerField': 'smallint',
     'TextField':         'text',
     'TimeField':         'time',
-    'URLField':          'varchar(200)',
     'USStateField':      'varchar(2)',
 }

File django/db/backends/mysql/creation.py

     'SmallIntegerField': 'smallint',
     'TextField':         'longtext',
     'TimeField':         'time',
-    'URLField':          'varchar(200)',
     'USStateField':      'varchar(2)',
 }

File django/db/backends/oracle/creation.py

     'SmallIntegerField': 'smallint',
     'TextField':         'long',
     'TimeField':         'timestamp',
-    'URLField':          'varchar(200)',
     'USStateField':      'varchar(2)',
 }

File django/db/backends/postgresql/creation.py

     'SmallIntegerField': 'smallint',
     'TextField':         'text',
     'TimeField':         'time',
-    'URLField':          'varchar(200)',
     'USStateField':      'varchar(2)',
 }

File django/db/backends/sqlite3/creation.py

     'SmallIntegerField':            'smallint',
     'TextField':                    'text',
     'TimeField':                    'time',
-    'URLField':                     'varchar(200)',
     'USStateField':                 'varchar(2)',
 }

File django/db/models/fields/__init__.py

     def formfield(self, initial=None):
         return forms.TimeField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial)
 
-class URLField(Field):
+class URLField(CharField):
     def __init__(self, verbose_name=None, name=None, verify_exists=True, **kwargs):
+        kwargs['maxlength'] = kwargs.get('maxlength', 200) 
         if verify_exists:
             kwargs.setdefault('validator_list', []).append(validators.isExistingURL)
         self.verify_exists = verify_exists
-        Field.__init__(self, verbose_name, name, **kwargs)
+        CharField.__init__(self, verbose_name, name, **kwargs)
 
     def get_manipulator_field_objs(self):
         return [oldforms.URLField]
 
+    def get_internal_type(self): 
+        return "CharField"
+
     def formfield(self, initial=None):
         return forms.URLField(required=not self.blank, verify_exists=self.verify_exists, label=capfirst(self.verbose_name), initial=initial)