Ticket #1296: slugfield.patch
File slugfield.patch, 4.4 KB (added by , 19 years ago) |
---|
-
django/contrib/admin/views/doc.py
260 260 'PhoneNumberField' : _('Phone number'), 261 261 'PositiveIntegerField' : _('Integer'), 262 262 'PositiveSmallIntegerField' : _('Integer'), 263 'SlugField' : _('String (up to 50)'),263 'SlugField' : _('String (up to %(maxlength)s)'), 264 264 'SmallIntegerField' : _('Integer'), 265 265 'TextField' : _('Text'), 266 266 'TimeField' : _('Time'), -
django/core/db/backends/ado_mssql.py
153 153 'PhoneNumberField': 'varchar(20)', 154 154 'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] > 0)', 155 155 'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%(column)s] CHECK ([%(column)s] > 0)', 156 'SlugField': 'varchar( 50)',156 'SlugField': 'varchar(%(maxlength)s)', 157 157 'SmallIntegerField': 'smallint', 158 158 'TextField': 'text', 159 159 'TimeField': 'time', -
django/core/db/backends/postgresql.py
176 176 'PhoneNumberField': 'varchar(20)', 177 177 'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)', 178 178 'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)', 179 'SlugField': 'varchar( 50)',179 'SlugField': 'varchar(%(maxlength)s)', 180 180 'SmallIntegerField': 'smallint', 181 181 'TextField': 'text', 182 182 'TimeField': 'time', -
django/core/db/backends/sqlite3.py
177 177 'PhoneNumberField': 'varchar(20)', 178 178 'PositiveIntegerField': 'integer unsigned', 179 179 'PositiveSmallIntegerField': 'smallint unsigned', 180 'SlugField': 'varchar( 50)',180 'SlugField': 'varchar(%(maxlength)s)', 181 181 'SmallIntegerField': 'smallint', 182 182 'TextField': 'text', 183 183 'TimeField': 'time', -
django/core/db/backends/mysql.py
174 174 'PhoneNumberField': 'varchar(20)', 175 175 'PositiveIntegerField': 'integer UNSIGNED', 176 176 'PositiveSmallIntegerField': 'smallint UNSIGNED', 177 'SlugField': 'varchar( 50)',177 'SlugField': 'varchar(%(maxlength)s)', 178 178 'SmallIntegerField': 'smallint', 179 179 'TextField': 'longtext', 180 180 'TimeField': 'time', -
django/core/meta/fields.py
604 604 605 605 class SlugField(Field): 606 606 def __init__(self, *args, **kwargs): 607 kwargs['maxlength'] = 50 607 # Default to a maxlength of 50 but allow overrides 608 if not kwargs.has_key('maxlength'): 609 kwargs['maxlength'] = 50 608 610 kwargs.setdefault('validator_list', []).append(validators.isSlug) 609 611 # Set db_index=True unless it's been set manually. 610 612 if not kwargs.has_key('db_index'): -
docs/model-api.txt
409 409 "Slug" is a newspaper term. A slug is a short label for something, 410 410 containing only letters, numbers, underscores or hyphens. They're generally 411 411 used in URLs. 412 413 If ``maxlength`` is specified, it will override the default length of 50. 412 414 413 Implies `` maxlength=50`` and ``db_index=True``.415 Implies ``db_index=True``. 414 416 415 417 Accepts an extra option, ``prepopulate_from``, which is a list of fields 416 418 from which to auto-populate the slug, via JavaScript, in the object's admin