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
8fe43236
Commit
8fe43236
authored
May 18, 2013
by
Pablo Recio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved test model into closer to the testcase
parent
53a80044
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
27 deletions
+27
-27
rest_framework/tests/models.py
+0
-26
rest_framework/tests/serializer.py
+27
-1
No files found.
rest_framework/tests/models.py
View file @
8fe43236
...
@@ -117,32 +117,6 @@ class OptionalRelationModel(RESTFrameworkModel):
...
@@ -117,32 +117,6 @@ class OptionalRelationModel(RESTFrameworkModel):
other
=
models
.
ForeignKey
(
'OptionalRelationModel'
,
blank
=
True
,
null
=
True
)
other
=
models
.
ForeignKey
(
'OptionalRelationModel'
,
blank
=
True
,
null
=
True
)
# Model for issue #725
class
SeveralChoicesModel
(
RESTFrameworkModel
):
color
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'red'
,
'Red'
),
(
'green'
,
'Green'
),
(
'blue'
,
'Blue'
)],
blank
=
False
)
drink
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'beer'
,
'Beer'
),
(
'wine'
,
'Wine'
),
(
'cider'
,
'Cider'
)],
blank
=
False
,
default
=
'beer'
)
os
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'linux'
,
'Linux'
),
(
'osx'
,
'OSX'
),
(
'windows'
,
'Windows'
)],
blank
=
True
)
music_genre
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'rock'
,
'Rock'
),
(
'metal'
,
'Metal'
),
(
'grunge'
,
'Grunge'
)],
blank
=
True
,
default
=
'metal'
)
# Model for RegexField
# Model for RegexField
class
Book
(
RESTFrameworkModel
):
class
Book
(
RESTFrameworkModel
):
isbn
=
models
.
CharField
(
max_length
=
13
)
isbn
=
models
.
CharField
(
max_length
=
13
)
...
...
rest_framework/tests/serializer.py
View file @
8fe43236
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.db
import
models
from
django.db.models.fields
import
BLANK_CHOICE_DASH
from
django.db.models.fields
import
BLANK_CHOICE_DASH
from
django.utils.datastructures
import
MultiValueDict
from
django.utils.datastructures
import
MultiValueDict
from
django.test
import
TestCase
from
django.test
import
TestCase
from
rest_framework
import
serializers
from
rest_framework
import
serializers
from
rest_framework.tests.models
import
(
HasPositiveIntegerAsChoice
,
Album
,
ActionItem
,
Anchor
,
BasicModel
,
from
rest_framework.tests.models
import
(
HasPositiveIntegerAsChoice
,
Album
,
ActionItem
,
Anchor
,
BasicModel
,
BlankFieldModel
,
BlogPost
,
BlogPostComment
,
Book
,
CallableDefaultValueModel
,
DefaultValueModel
,
BlankFieldModel
,
BlogPost
,
BlogPostComment
,
Book
,
CallableDefaultValueModel
,
DefaultValueModel
,
ManyToManyModel
,
Person
,
ReadOnlyManyToManyModel
,
Photo
,
SeveralChoicesModel
)
ManyToManyModel
,
Person
,
ReadOnlyManyToManyModel
,
Photo
)
import
datetime
import
datetime
import
pickle
import
pickle
...
@@ -1003,6 +1004,31 @@ class SerializerPickleTests(TestCase):
...
@@ -1003,6 +1004,31 @@ class SerializerPickleTests(TestCase):
# test for issue #725
# test for issue #725
class
SeveralChoicesModel
(
models
.
Model
):
color
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'red'
,
'Red'
),
(
'green'
,
'Green'
),
(
'blue'
,
'Blue'
)],
blank
=
False
)
drink
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'beer'
,
'Beer'
),
(
'wine'
,
'Wine'
),
(
'cider'
,
'Cider'
)],
blank
=
False
,
default
=
'beer'
)
os
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'linux'
,
'Linux'
),
(
'osx'
,
'OSX'
),
(
'windows'
,
'Windows'
)],
blank
=
True
)
music_genre
=
models
.
CharField
(
max_length
=
10
,
choices
=
[(
'rock'
,
'Rock'
),
(
'metal'
,
'Metal'
),
(
'grunge'
,
'Grunge'
)],
blank
=
True
,
default
=
'metal'
)
class
SerializerChoiceFields
(
TestCase
):
class
SerializerChoiceFields
(
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
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