Ticket #8556: 74333.patch

File 74333.patch, 626 bytes (added by gkelly, 16 years ago)

Patch to return formfield using regex

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

     
    394394
    395395# TODO: Maybe move this into contrib, because it's specialized.
    396396class CommaSeparatedIntegerField(CharField):
    397     pass
     397    def formfield(self, **kwargs):
     398        defaults = {
     399            'form_class': forms.RegexField,
     400            'regex': '^[\d,]*$',
     401            'max_length': self.max_length,
     402        }
     403        defaults.update(kwargs)
     404        return defaults
    398405
    399406ansi_date_re = re.compile(r'^\d{4}-\d{1,2}-\d{1,2}$')
    400407
Back to Top