--- a/content/blog/2011/06/django-advice.html Thu Jun 30 10:40:29 2011 -0400
+++ b/content/blog/2011/06/django-advice.html Thu Jun 30 13:34:56 2011 -0400
@@ -780,7 +780,7 @@
list_display = ('title', 'author_name')
def author_name(self, obj):
- return o.name
+ return obj.name
That will display the name just fine. However, it won't be a fully-fledged column in
the Django admin because you can't sort on it.
@@ -794,7 +794,7 @@
list_display = ('title', 'author_name')
def author_name(self, obj):
- return o.name
+ return obj.name
author_name.admin_order_field = 'author__name'
Now the author name has all the functionality of a real `list_display` entry.