mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 13:14:30 +03:00
Moved test model into closer to the testcase
This commit is contained in:
parent
53a8004401
commit
8fe43236a2
|
@ -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)
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
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):
|
||||||
|
|
||||||
|
|
||||||
# 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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user