From fc0ec571c26c03cafc9066ae25c13b54dd18ab65 Mon Sep 17 00:00:00 2001 From: Petros Moisiadis Date: Wed, 16 Dec 2015 20:59:46 +0200 Subject: [PATCH] Include 'initial' attribute of serializer fields in metadata responses Frontend applications may now use the response of an OPTIONS request so as to populate the fields for "add/new/create" type of forms with initial values based on the 'initial' attribute of the serializer's fields. --- rest_framework/metadata.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/metadata.py b/rest_framework/metadata.py index 6c4f17692..5a21a0d44 100644 --- a/rest_framework/metadata.py +++ b/rest_framework/metadata.py @@ -124,7 +124,8 @@ class SimpleMetadata(BaseMetadata): attrs = [ 'read_only', 'label', 'help_text', 'min_length', 'max_length', - 'min_value', 'max_value' + 'min_value', 'max_value', + 'initial' ] for attr in attrs: