summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_views/models.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-08 18:07:33 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-08 18:07:33 +0000
commitab8965c428ed4390c006c3375ba30595008fa525 (patch)
tree0ce065d239096cecb8a2e99ed60a77f02c0c5092 /tests/regressiontests/admin_views/models.py
parentbe4390f834fa5061c0e3f9dde5b811f34fc1b2c4 (diff)
Added a few force_unicode() calls around objects in the admin. Required for
Python 2.3 compatibility. Patch from nfg. Refs #8151, #8153. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8236 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views/models.py')
-rw-r--r--tests/regressiontests/admin_views/models.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
index 2062107397..a8fc9467ba 100644
--- a/tests/regressiontests/admin_views/models.py
+++ b/tests/regressiontests/admin_views/models.py
@@ -3,7 +3,7 @@ from django.contrib import admin
class Section(models.Model):
"""
- A simple section that links to articles, to test linking to related items
+ A simple section that links to articles, to test linking to related items
in admin views.
"""
name = models.CharField(max_length=100)
@@ -12,14 +12,18 @@ class Article(models.Model):
"""
A simple article to test admin views. Test backwards compatibility.
"""
+ title = models.CharField(max_length=100)
content = models.TextField()
date = models.DateTimeField()
section = models.ForeignKey(Section)
+ def __unicode__(self):
+ return self.title
+
class ArticleAdmin(admin.ModelAdmin):
list_display = ('content', 'date')
list_filter = ('date',)
-
+
def changelist_view(self, request):
"Test that extra_context works"
return super(ArticleAdmin, self).changelist_view(
@@ -40,7 +44,7 @@ class CustomArticleAdmin(admin.ModelAdmin):
change_form_template = 'custom_admin/change_form.html'
object_history_template = 'custom_admin/object_history.html'
delete_confirmation_template = 'custom_admin/delete_confirmation.html'
-
+
def changelist_view(self, request):
"Test that extra_context works"
return super(CustomArticleAdmin, self).changelist_view(
@@ -51,10 +55,10 @@ class CustomArticleAdmin(admin.ModelAdmin):
class ModelWithStringPrimaryKey(models.Model):
id = models.CharField(max_length=255, primary_key=True)
-
+
def __unicode__(self):
return self.id
-
+
admin.site.register(Article, ArticleAdmin)
admin.site.register(CustomArticle, CustomArticleAdmin)
admin.site.register(Section)