diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-20 19:56:44 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-20 19:56:44 +0000 |
| commit | 334279f8dd3abd98aa527a1658cb3ff5c3973ec7 (patch) | |
| tree | f440439fc9f79a39cfb90c16bf5c2df0106b14ee /tests/regressiontests/model_fields/models.py | |
| parent | 04da22633fcda983cb9ee69e63b2ebe99301b717 (diff) | |
queryset-refactor: Merged from trunk up to [7338].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7341 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_fields/models.py')
| -rw-r--r-- | tests/regressiontests/model_fields/models.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/models.py b/tests/regressiontests/model_fields/models.py index e69de29bb2..7e07227961 100644 --- a/tests/regressiontests/model_fields/models.py +++ b/tests/regressiontests/model_fields/models.py @@ -0,0 +1,24 @@ + +from django.db import models + +class Foo(models.Model): + a = models.CharField(max_length=10) + +def get_foo(): + return Foo.objects.get(id=1) + +class Bar(models.Model): + b = models.CharField(max_length=10) + a = models.ForeignKey(Foo, default=get_foo) + +__test__ = {'API_TESTS':""" +# Create a couple of Places. +>>> f = Foo.objects.create(a='abc') +>>> f.id +1 +>>> b = Bar(b = "bcd") +>>> b.a +<Foo: Foo object> +>>> b.save() + +"""} |
