diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index a374bf5..21401ca 100644
a
|
b
|
pagination = register.inclusion_tag('admin/pagination.html')(pagination)
|
70 | 70 | |
71 | 71 | def result_headers(cl): |
72 | 72 | lookup_opts = cl.lookup_opts |
73 | | |
| 73 | |
74 | 74 | for i, field_name in enumerate(cl.list_display): |
75 | 75 | attr = None |
76 | 76 | try: |
… |
… |
def result_headers(cl):
|
97 | 97 | raise AttributeError, \ |
98 | 98 | "'%s' model or '%s' objects have no attribute '%s'" % \ |
99 | 99 | (lookup_opts.object_name, cl.model_admin.__class__, field_name) |
100 | | |
| 100 | |
101 | 101 | try: |
102 | 102 | header = attr.short_description |
103 | 103 | except AttributeError: |
… |
… |
def items_for_result(cl, result, form):
|
237 | 237 | result_repr = conditional_escape(result_repr) |
238 | 238 | yield mark_safe(u'<td%s>%s</td>' % (row_class, result_repr)) |
239 | 239 | if form: |
240 | | yield mark_safe(force_unicode(form[cl.model._meta.pk.attname])) |
| 240 | yield mark_safe(force_unicode(form[cl.model._meta.pk.name])) |
241 | 241 | |
242 | 242 | def results(cl): |
243 | 243 | if cl.formset: |
diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
index e5e112f..3546463 100644
a
|
b
|
class Person(models.Model):
|
143 | 143 | name = models.CharField(max_length=100) |
144 | 144 | gender = models.IntegerField(choices=GENDER_CHOICES) |
145 | 145 | alive = models.BooleanField() |
146 | | |
| 146 | |
147 | 147 | def __unicode__(self): |
148 | 148 | return self.name |
149 | | |
| 149 | |
150 | 150 | class Meta: |
151 | 151 | ordering = ["id"] |
152 | 152 | |
… |
… |
def redirect_to(request, selected):
|
236 | 236 | class ExternalSubscriberAdmin(admin.ModelAdmin): |
237 | 237 | actions = [external_mail, redirect_to] |
238 | 238 | |
| 239 | class Media(models.Model): |
| 240 | name = models.CharField(max_length=60) |
| 241 | |
| 242 | class Podcast(Media): |
| 243 | release_date = models.DateField() |
| 244 | |
| 245 | class PodcastAdmin(admin.ModelAdmin): |
| 246 | list_display = ('name', 'release_date') |
| 247 | list_editable = ('release_date',) |
| 248 | |
| 249 | ordering = ('name',) |
| 250 | |
239 | 251 | admin.site.register(Article, ArticleAdmin) |
240 | 252 | admin.site.register(CustomArticle, CustomArticleAdmin) |
241 | 253 | admin.site.register(Section, inlines=[ArticleInline]) |
… |
… |
admin.site.register(Person, PersonAdmin)
|
246 | 258 | admin.site.register(Persona, PersonaAdmin) |
247 | 259 | admin.site.register(Subscriber, SubscriberAdmin) |
248 | 260 | admin.site.register(ExternalSubscriber, ExternalSubscriberAdmin) |
| 261 | admin.site.register(Podcast, PodcastAdmin) |
249 | 262 | |
250 | 263 | # We intentionally register Promo and ChapterXtra1 but not Chapter nor ChapterXtra2. |
251 | 264 | # That way we cover all four cases: |
… |
… |
admin.site.register(ExternalSubscriber, ExternalSubscriberAdmin)
|
259 | 272 | admin.site.register(Book, inlines=[ChapterInline]) |
260 | 273 | admin.site.register(Promo) |
261 | 274 | admin.site.register(ChapterXtra1) |
262 | | |
263 | | |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index ce63567..e1517e8 100644
a
|
b
|
|
1 | 1 | # coding: utf-8 |
2 | 2 | |
3 | 3 | import re |
| 4 | import datetime |
4 | 5 | |
5 | 6 | from django.test import TestCase |
6 | 7 | from django.contrib.auth.models import User, Permission |
… |
… |
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
|
12 | 13 | from django.utils.html import escape |
13 | 14 | |
14 | 15 | # local test models |
15 | | from models import Article, CustomArticle, Section, ModelWithStringPrimaryKey, Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber |
| 16 | from models import Article, CustomArticle, Section, ModelWithStringPrimaryKey, Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber, Podcast |
16 | 17 | |
17 | 18 | try: |
18 | 19 | set |
… |
… |
class AdminViewListEditable(TestCase):
|
740 | 741 | def tearDown(self): |
741 | 742 | self.client.logout() |
742 | 743 | |
| 744 | def test_inheritance(self): |
| 745 | Podcast.objects.create(name="TWID", release_date=datetime.date.today()) |
| 746 | response = self.client.get('/test_admin/admin/admin_views/podcast/') |
| 747 | self.failUnlessEqual(response.status_code, 200) |
| 748 | |
743 | 749 | def test_changelist_input_html(self): |
744 | 750 | response = self.client.get('/test_admin/admin/admin_views/person/') |
745 | 751 | # 2 inputs per object(the field and the hidden id field) = 6 |