mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Properly render file inputs in the Browsable api.
This commit is contained in:
parent
5443dd5f3c
commit
8cdbc0a33a
|
@ -908,7 +908,7 @@ class FloatField(WritableField):
|
||||||
|
|
||||||
class FileField(WritableField):
|
class FileField(WritableField):
|
||||||
type_name = 'FileField'
|
type_name = 'FileField'
|
||||||
|
widget = widgets.FileInput
|
||||||
default_error_messages = {
|
default_error_messages = {
|
||||||
'invalid': _("No file was submitted. Check the encoding type on the form."),
|
'invalid': _("No file was submitted. Check the encoding type on the form."),
|
||||||
'missing': _("No file was submitted."),
|
'missing': _("No file was submitted."),
|
||||||
|
|
|
@ -320,7 +320,9 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
serializers.SlugRelatedField: forms.ChoiceField,
|
serializers.SlugRelatedField: forms.ChoiceField,
|
||||||
serializers.ManySlugRelatedField: forms.MultipleChoiceField,
|
serializers.ManySlugRelatedField: forms.MultipleChoiceField,
|
||||||
serializers.HyperlinkedRelatedField: forms.ChoiceField,
|
serializers.HyperlinkedRelatedField: forms.ChoiceField,
|
||||||
serializers.ManyHyperlinkedRelatedField: forms.MultipleChoiceField
|
serializers.ManyHyperlinkedRelatedField: forms.MultipleChoiceField,
|
||||||
|
serializers.FileField: forms.FileField,
|
||||||
|
serializers.ImageField: forms.ImageField,
|
||||||
}
|
}
|
||||||
|
|
||||||
fields = {}
|
fields = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user