Fixed #17219 -- Updated model field descriptions to be more precise. Thanks, charettes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17476 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
46f1369d92
commit
2aae057727
|
@ -509,6 +509,7 @@ class AutoField(Field):
|
||||||
default_error_messages = {
|
default_error_messages = {
|
||||||
'invalid': _(u"'%s' value must be an integer."),
|
'invalid': _(u"'%s' value must be an integer."),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
assert kwargs.get('primary_key', False) is True, \
|
assert kwargs.get('primary_key', False) is True, \
|
||||||
"%ss must have primary_key=True." % self.__class__.__name__
|
"%ss must have primary_key=True." % self.__class__.__name__
|
||||||
|
@ -551,6 +552,7 @@ class BooleanField(Field):
|
||||||
'invalid': _(u"'%s' value must be either True or False."),
|
'invalid': _(u"'%s' value must be either True or False."),
|
||||||
}
|
}
|
||||||
description = _("Boolean (Either True or False)")
|
description = _("Boolean (Either True or False)")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs['blank'] = True
|
kwargs['blank'] = True
|
||||||
if 'default' not in kwargs and not kwargs.get('null'):
|
if 'default' not in kwargs and not kwargs.get('null'):
|
||||||
|
@ -1111,7 +1113,7 @@ class NullBooleanField(Field):
|
||||||
return super(NullBooleanField, self).formfield(**defaults)
|
return super(NullBooleanField, self).formfield(**defaults)
|
||||||
|
|
||||||
class PositiveIntegerField(IntegerField):
|
class PositiveIntegerField(IntegerField):
|
||||||
description = _("Integer")
|
description = _("Positive integer")
|
||||||
|
|
||||||
def get_internal_type(self):
|
def get_internal_type(self):
|
||||||
return "PositiveIntegerField"
|
return "PositiveIntegerField"
|
||||||
|
@ -1122,7 +1124,8 @@ class PositiveIntegerField(IntegerField):
|
||||||
return super(PositiveIntegerField, self).formfield(**defaults)
|
return super(PositiveIntegerField, self).formfield(**defaults)
|
||||||
|
|
||||||
class PositiveSmallIntegerField(IntegerField):
|
class PositiveSmallIntegerField(IntegerField):
|
||||||
description = _("Integer")
|
description = _("Positive small integer")
|
||||||
|
|
||||||
def get_internal_type(self):
|
def get_internal_type(self):
|
||||||
return "PositiveSmallIntegerField"
|
return "PositiveSmallIntegerField"
|
||||||
|
|
||||||
|
@ -1132,7 +1135,8 @@ class PositiveSmallIntegerField(IntegerField):
|
||||||
return super(PositiveSmallIntegerField, self).formfield(**defaults)
|
return super(PositiveSmallIntegerField, self).formfield(**defaults)
|
||||||
|
|
||||||
class SlugField(CharField):
|
class SlugField(CharField):
|
||||||
description = _("String (up to %(max_length)s)")
|
description = _("Slug (up to %(max_length)s)")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs['max_length'] = kwargs.get('max_length', 50)
|
kwargs['max_length'] = kwargs.get('max_length', 50)
|
||||||
# Set db_index=True unless it's been set manually.
|
# Set db_index=True unless it's been set manually.
|
||||||
|
@ -1149,7 +1153,7 @@ class SlugField(CharField):
|
||||||
return super(SlugField, self).formfield(**defaults)
|
return super(SlugField, self).formfield(**defaults)
|
||||||
|
|
||||||
class SmallIntegerField(IntegerField):
|
class SmallIntegerField(IntegerField):
|
||||||
description = _("Integer")
|
description = _("Small integer")
|
||||||
|
|
||||||
def get_internal_type(self):
|
def get_internal_type(self):
|
||||||
return "SmallIntegerField"
|
return "SmallIntegerField"
|
||||||
|
|
|
@ -211,7 +211,7 @@ class FileField(Field):
|
||||||
# The descriptor to use for accessing the attribute off of the class.
|
# The descriptor to use for accessing the attribute off of the class.
|
||||||
descriptor_class = FileDescriptor
|
descriptor_class = FileDescriptor
|
||||||
|
|
||||||
description = _("File path")
|
description = _("File")
|
||||||
|
|
||||||
def __init__(self, verbose_name=None, name=None, upload_to='', storage=None, **kwargs):
|
def __init__(self, verbose_name=None, name=None, upload_to='', storage=None, **kwargs):
|
||||||
for arg in ('primary_key', 'unique'):
|
for arg in ('primary_key', 'unique'):
|
||||||
|
@ -318,7 +318,7 @@ class ImageFieldFile(ImageFile, FieldFile):
|
||||||
class ImageField(FileField):
|
class ImageField(FileField):
|
||||||
attr_class = ImageFieldFile
|
attr_class = ImageFieldFile
|
||||||
descriptor_class = ImageFileDescriptor
|
descriptor_class = ImageFileDescriptor
|
||||||
description = _("File path")
|
description = _("Image")
|
||||||
|
|
||||||
def __init__(self, verbose_name=None, name=None, width_field=None,
|
def __init__(self, verbose_name=None, name=None, width_field=None,
|
||||||
height_field=None, **kwargs):
|
height_field=None, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue