-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Description
While trying to use the Field.initial
property just like I'm used to do that with regular Django fields, in DRF this property does not accept a callable. When rendering serializer fields in HTML the initial
becomes something like <function func_name_here0x0000000>
Example:
def some_callable():
return uuid4().hex
class FooSerializer(serializers.Serializer):
test_field = serializers.CharField(initial=some_callable)
The expected behaviour (in a default Django field) would be a input with a uuid
as it's initial value, but DRF tries to render the function object.
Metadata
Metadata
Assignees
Labels
No labels