Merge pull request #470 from minddust/fix-#469

fixed #469 - RegexField <--> BrowsableAPI Bug
This commit is contained in:
Tom Christie 2012-12-06 14:58:18 -08:00
commit a463ddbb37
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].
## Master
* Bugfix: Fix `RegexField` to work with `BrowsableAPIRenderer`
## 2.1.6
**Date**: 23rd Nov 2012

View File

@ -817,6 +817,7 @@ class EmailField(CharField):
class RegexField(CharField):
type_name = 'RegexField'
form_field_class = forms.RegexField
def __init__(self, regex, max_length=None, min_length=None, *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:
kwargs['choices'] = v.choices
if getattr(v, 'regex', None) is not None:
kwargs['regex'] = v.regex
if getattr(v, 'widget', None):
widget = copy.deepcopy(v.widget)
kwargs['widget'] = widget