mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
fixed #469 - RegexField <--> BrowsableAPI Bug
This commit is contained in:
parent
3e3ede71d2
commit
e044fa089b
|
@ -4,6 +4,10 @@
|
||||||
>
|
>
|
||||||
> — Eric S. Raymond, [The Cathedral and the Bazaar][cite].
|
> — 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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user