aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/models.py
diff options
context:
space:
mode:
authorJacob Magnusson2012-11-18 18:14:21 +0100
committerJacob Magnusson2012-11-18 18:14:21 +0100
commitd67ee708e5d9f28f26377df391f5e72708e073d2 (patch)
tree5af010c124e7ee12b6eaab0ccc2d681e02c1f507 /rest_framework/tests/models.py
parent346a79b170b0a25fd28354de765c5aa5aca9a119 (diff)
downloaddjango-rest-framework-d67ee708e5d9f28f26377df391f5e72708e073d2.tar.bz2
Add support for min_length / max_length keywords
on basic ModelFields
Diffstat (limited to 'rest_framework/tests/models.py')
-rw-r--r--rest_framework/tests/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/rest_framework/tests/models.py b/rest_framework/tests/models.py
index cbdc765c..59d81150 100644
--- a/rest_framework/tests/models.py
+++ b/rest_framework/tests/models.py
@@ -35,6 +35,13 @@ def foobar():
return 'foobar'
+class CustomField(models.CharField):
+
+ def __init__(self, *args, **kwargs):
+ kwargs['max_length'] = 12
+ super(CustomField, self).__init__(*args, **kwargs)
+
+
class RESTFrameworkModel(models.Model):
"""
Base for test models that sets app_label, so they play nicely.
@@ -113,6 +120,7 @@ class Comment(RESTFrameworkModel):
class ActionItem(RESTFrameworkModel):
title = models.CharField(max_length=200)
done = models.BooleanField(default=False)
+ info = CustomField(default='---', max_length=12)
# Models for reverse relations