aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/models.py
diff options
context:
space:
mode:
authorPablo Recio2013-05-18 12:40:25 +0200
committerPablo Recio2013-05-18 12:41:52 +0200
commitab8bd566f9db327a4c463317011818d421bbf89c (patch)
tree0ee831228591b1a7ad10636539d1f6592ba6f6a1 /rest_framework/tests/models.py
parentde5cc8de423a22009d2a643f6c268805f715b212 (diff)
downloaddjango-rest-framework-ab8bd566f9db327a4c463317011818d421bbf89c.tar.bz2
Adding `BLANK_CHOICE_DASH` as a choice if the model's field isn't required
Diffstat (limited to 'rest_framework/tests/models.py')
-rw-r--r--rest_framework/tests/models.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/rest_framework/tests/models.py b/rest_framework/tests/models.py
index 40e41a64..5d98b04b 100644
--- a/rest_framework/tests/models.py
+++ b/rest_framework/tests/models.py
@@ -117,6 +117,32 @@ class OptionalRelationModel(RESTFrameworkModel):
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
class Book(RESTFrameworkModel):
isbn = models.CharField(max_length=13)