Ticket #6281: 6281-slugfield-formfield.patch
File 6281-slugfield-formfield.patch, 773 bytes (added by , 17 years ago) |
---|
-
django/db/models/fields/__init__.py
951 951 kwargs['db_index'] = True 952 952 super(SlugField, self).__init__(*args, **kwargs) 953 953 954 def formfield(self, **kwargs): 955 defaults = {'form_class': forms.RegexField, 'regex': r'^[-\w]+$', 956 'error_messages': {'invalid': _("This value must contain only letters, numbers, underscores or hyphens.")}} 957 return super(SlugField, self).formfield(**defaults) 958 954 959 class SmallIntegerField(IntegerField): 955 960 def get_manipulator_field_objs(self): 956 961 return [oldforms.SmallIntegerField]