diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-07-04 12:11:04 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-07-04 12:11:04 +0000 |
| commit | 953badbea5a04159adbfa970f5805c0232b6a401 (patch) | |
| tree | 9569f74b5d382b222613a1085efd0de21937e95f /tests/modeltests/model_forms | |
| parent | 4c958b15b250866b70ded7d82aa532f1e57f96ae (diff) | |
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/model_forms')
| -rw-r--r-- | tests/modeltests/model_forms/models.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py index 6ffd4d1bce..a21bef02ce 100644 --- a/tests/modeltests/model_forms/models.py +++ b/tests/modeltests/model_forms/models.py @@ -34,13 +34,13 @@ class Category(models.Model): name = models.CharField(maxlength=20) url = models.CharField('The URL', maxlength=40) - def __str__(self): + def __unicode__(self): return self.name class Writer(models.Model): name = models.CharField(maxlength=50, help_text='Use both first and last names.') - def __str__(self): + def __unicode__(self): return self.name class Article(models.Model): @@ -58,14 +58,14 @@ class Article(models.Model): self.created = datetime.date.today() return super(Article, self).save() - def __str__(self): + def __unicode__(self): return self.headline class PhoneNumber(models.Model): phone = models.PhoneNumberField() description = models.CharField(maxlength=20) - def __str__(self): + def __unicode__(self): return self.phone __test__ = {'API_TESTS': """ @@ -244,10 +244,10 @@ True 1 >>> test_art = Article.objects.get(id=1) >>> test_art.headline -'Test headline' +u'Test headline' -You can create a form over a subset of the available fields -by specifying a 'fields' argument to form_for_instance. +You can create a form over a subset of the available fields +by specifying a 'fields' argument to form_for_instance. >>> PartialArticleForm = form_for_instance(art, fields=('headline','pub_date')) >>> f = PartialArticleForm({'headline': u'New headline', 'pub_date': u'1988-01-04'}, auto_id=False) >>> print f.as_ul() @@ -260,7 +260,7 @@ True 1 >>> new_art = Article.objects.get(id=1) >>> new_art.headline -'New headline' +u'New headline' Add some categories and test the many-to-many form output. >>> new_art.categories.all() |
