summaryrefslogtreecommitdiff
path: root/docs/releases/1.0-porting-guide.txt
diff options
context:
space:
mode:
authorSimon Willison <simon@simonwillison.net>2008-09-02 18:38:55 +0000
committerSimon Willison <simon@simonwillison.net>2008-09-02 18:38:55 +0000
commite00aa16e24c55ed52d97a3adb31ce8d93ceb739e (patch)
treeec76fe6a06513018d98524cfdf43463c6417644b /docs/releases/1.0-porting-guide.txt
parenta658d45a6c11798cd7d848d2d7aacde18ca173c0 (diff)
Fixed spelling typo in porting guide and added __str__ to __unicode__ to the model example
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8865 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/releases/1.0-porting-guide.txt')
-rw-r--r--docs/releases/1.0-porting-guide.txt10
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/releases/1.0-porting-guide.txt b/docs/releases/1.0-porting-guide.txt
index 6380129e93..53ed2f814e 100644
--- a/docs/releases/1.0-porting-guide.txt
+++ b/docs/releases/1.0-porting-guide.txt
@@ -80,6 +80,9 @@ Old (0.96) ``models.py``::
class Admin:
list_display = ['first_name', 'last_name']
+ def __str__(self):
+ return '%s %s' % (self.first_name, self.last_name)
+
New (1.0) ``models.py``::
class Author(models.Model):
@@ -87,13 +90,16 @@ New (1.0) ``models.py``::
last_name = models.CharField(max_length=30)
slug = models.CharField(max_length=60)
+ def __unicode__(self):
+ return u'%s %s' % (self.first_name, self.last_name)
+
New (1.0) ``admin.py``::
from django.contrib import admin
from models import Author
class AuthorAdmin(admin.ModelAdmin):
- list_display=['first_name', 'last_name']
+ list_display = ['first_name', 'last_name']
prepopulated_fields = {
'slug': ('first_name', 'last_name')
}
@@ -109,7 +115,7 @@ definitions are now completely decoupled from model definitions, the framework
as been rewritten to use Django's new form-handling library and redesigned with
extensibility and customization in mind.
-Practially, this means you'll need to rewrite all of your ``class Admin``
+Practically, this means you'll need to rewrite all of your ``class Admin``
declarations. You've already seen in `models`_ above how to replace your ``class
Admin`` with a ``admin.site.register()`` call in an ``admin.py`` file. Below are
some more details on how to rewrite that ``Admin`` declaration into the new