Ticket #3557: slugfield.patch

File slugfield.patch, 1.0 KB (added by Russell Cloran <russell@…>, 8 years ago)

Patch to fix SlugField in newforms

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

     
    758758    def get_manipulator_field_objs(self):
    759759        return [oldforms.PositiveSmallIntegerField]
    760760
    761 class SlugField(Field):
     761class SlugField(CharField):
    762762    def __init__(self, *args, **kwargs):
    763763        kwargs['maxlength'] = kwargs.get('maxlength', 50)
    764764        kwargs.setdefault('validator_list', []).append(validators.isSlug)
    765765        # Set db_index=True unless it's been set manually.
    766766        if not kwargs.has_key('db_index'):
    767767            kwargs['db_index'] = True
    768         Field.__init__(self, *args, **kwargs)
     768        CharField.__init__(self, *args, **kwargs)
    769769
    770     def get_manipulator_field_objs(self):
    771         return [oldforms.TextField]
    772 
    773770class SmallIntegerField(IntegerField):
    774771    def get_manipulator_field_objs(self):
    775772        return [oldforms.SmallIntegerField]
Back to Top