Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
54096dc2
Commit
54096dc2
authored
Aug 04, 2016
by
Corentin Smith
Committed by
Tom Christie
Aug 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add imports in validators docs (#4355)
parent
a9a09749
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
docs/api-guide/validators.md
+7
-1
No files found.
docs/api-guide/validators.md
View file @
54096dc2
...
...
@@ -64,6 +64,8 @@ It takes a single required argument, and an optional `messages` argument:
This validator should be applied to
*serializer fields*
, like so:
from rest_framework.validators import UniqueValidator
slug = SlugField(
max_length=100,
validators=[UniqueValidator(queryset=BlogPost.objects.all())]
...
...
@@ -80,6 +82,8 @@ It has two required arguments, and a single optional `messages` argument:
The validator should be applied to
*serializer classes*
, like so:
from rest_framework.validators import UniqueTogetherValidator
class ExampleSerializer(serializers.Serializer):
# ...
class Meta:
...
...
@@ -114,6 +118,8 @@ These validators can be used to enforce the `unique_for_date`, `unique_for_month
The validator should be applied to
*serializer classes*
, like so:
from rest_framework.validators import UniqueForYearValidator
class ExampleSerializer(serializers.Serializer):
# ...
class Meta:
...
...
@@ -183,7 +189,7 @@ It takes a single argument, which is the default value or callable that should b
created_at = serializers.DateTimeField(
read_only=True,
default=CreateOnlyDefault(timezone.now)
default=
serializers.
CreateOnlyDefault(timezone.now)
)
---
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment