fixed #469 - RegexField <--> BrowsableAPI Bug

This commit is contained in:
Stephan Groß 2012-12-04 09:40:23 +01:00
parent 3e3ede71d2
commit e044fa089b
3 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,10 @@
> >
> &mdash; Eric S. Raymond, [The Cathedral and the Bazaar][cite]. > &mdash; Eric S. Raymond, [The Cathedral and the Bazaar][cite].
## Master
* Bugfix: Fix `RegexField` to work with `BrowsableAPIRenderer`
## 2.1.6 ## 2.1.6
**Date**: 23rd Nov 2012 **Date**: 23rd Nov 2012

View File

@ -817,6 +817,7 @@ class EmailField(CharField):
class RegexField(CharField): class RegexField(CharField):
type_name = 'RegexField' type_name = 'RegexField'
form_field_class = forms.RegexField
def __init__(self, regex, max_length=None, min_length=None, *args, **kwargs): def __init__(self, regex, max_length=None, min_length=None, *args, **kwargs):
super(RegexField, self).__init__(max_length, min_length, *args, **kwargs) super(RegexField, self).__init__(max_length, min_length, *args, **kwargs)

View File

@ -320,6 +320,9 @@ class BrowsableAPIRenderer(BaseRenderer):
if getattr(v, 'choices', None) is not None: if getattr(v, 'choices', None) is not None:
kwargs['choices'] = v.choices kwargs['choices'] = v.choices
if getattr(v, 'regex', None) is not None:
kwargs['regex'] = v.regex
if getattr(v, 'widget', None): if getattr(v, 'widget', None):
widget = copy.deepcopy(v.widget) widget = copy.deepcopy(v.widget)
kwargs['widget'] = widget kwargs['widget'] = widget