diff options
| author | Tom Christie | 2012-10-04 09:29:12 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-10-04 09:29:12 +0100 |
| commit | d79e18963e64c1714a29ece6ca59a8a4a1c02516 (patch) | |
| tree | 1b74317c74794a868856c8db0cf247e3e7034a8a /rest_framework/tests/models.py | |
| parent | f8edfa26759bd9922b674625cee5921c163ed40e (diff) | |
| download | django-rest-framework-d79e18963e64c1714a29ece6ca59a8a4a1c02516.tar.bz2 | |
Tests for default arguments on fields
Diffstat (limited to 'rest_framework/tests/models.py')
| -rw-r--r-- | rest_framework/tests/models.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/rest_framework/tests/models.py b/rest_framework/tests/models.py index 6cc2c311..969c8297 100644 --- a/rest_framework/tests/models.py +++ b/rest_framework/tests/models.py @@ -28,6 +28,10 @@ from django.db import models # 'pk': self.id # }) +def foobar(): + return 'foobar' + + class RESTFrameworkModel(models.Model): """ Base for test models that sets app_label, so they play nicely. @@ -45,5 +49,13 @@ class BasicModel(RESTFrameworkModel): text = models.CharField(max_length=100) +class DefaultValueModel(RESTFrameworkModel): + text = models.CharField(default='foobar', max_length=100) + + +class CallableDefaultValueModel(RESTFrameworkModel): + text = models.CharField(default=foobar, max_length=100) + + class ManyToManyModel(RESTFrameworkModel): rel = models.ManyToManyField(Anchor) |
