Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use datetime example for the Field.initial attribute
Just like regular Django fields, the example adopted uses a `datetiume.date.today` to
illustrate the functionality.
  • Loading branch information
erickwilder committed Feb 19, 2016
commit a32baeab0c4324989f0d7f17b934a671f2537105
8 changes: 4 additions & 4 deletions docs/api-guide/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ A text string that may be used as a description of the field in HTML form fields
A value that should be used for pre-populating the value of HTML form fields. You may pass a callable to it, just as
you may do with any regular Django `Field`:

def user_default_color():
return 'blue'

color = serializers.CharField(initial=user_default_color)
import datetime
from rest_framework import serializers
class ExampleSerializer(serializers.Serializer):
day = serializers.DateField(initial=datetime.date.today)

### `style`

Expand Down