summaryrefslogtreecommitdiff
path: root/tests/modeltests/model_forms
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-07 13:23:57 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-07 13:23:57 +0000
commit1e747f98af99a23c5aff7b460d5b845c3a9e2013 (patch)
tree6347c27684a68cf1ef76b92808aa9309b0688797 /tests/modeltests/model_forms
parent7ed1a919681b5b028c3f6eef1a862ff91b66feb2 (diff)
newforms-admin: Merged from trunk up to [5625]. This includes the Unicode
merge, however, not all of admin/ (and none of admindocs/) has been ported and checked yet. git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5627 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/model_forms')
-rw-r--r--tests/modeltests/model_forms/models.py16
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()