mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Ensure fields in docs forms are ordered
This commit is contained in:
parent
1ed82aa104
commit
c412de920e
|
@ -39,11 +39,11 @@ def field_to_schema(field):
|
|||
)
|
||||
elif isinstance(field, serializers.Serializer):
|
||||
return coreschema.Object(
|
||||
properties={
|
||||
key: field_to_schema(value)
|
||||
properties=OrderedDict([
|
||||
(key, field_to_schema(value))
|
||||
for key, value
|
||||
in field.fields.items()
|
||||
},
|
||||
]),
|
||||
title=title,
|
||||
description=description
|
||||
)
|
||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
import re
|
||||
|
||||
from collections import OrderedDict
|
||||
from django import template
|
||||
from django.template import loader
|
||||
from django.utils import six
|
||||
|
@ -76,10 +77,10 @@ def with_location(fields, location):
|
|||
@register.simple_tag
|
||||
def form_for_link(link):
|
||||
import coreschema
|
||||
properties = {
|
||||
field.name: field.schema or coreschema.String()
|
||||
properties = OrderedDict([
|
||||
(field.name, field.schema or coreschema.String())
|
||||
for field in link.fields
|
||||
}
|
||||
])
|
||||
required = [
|
||||
field.name
|
||||
for field in link.fields
|
||||
|
|
Loading…
Reference in New Issue
Block a user