diff --git a/tests/regressiontests/admin_util/models.py b/tests/regressiontests/admin_util/models.py
index 493e127..a66a615 100644
a
|
b
|
|
1 | 1 | from django.db import models |
2 | 2 | |
3 | | |
4 | | |
5 | 3 | class Article(models.Model): |
6 | 4 | """ |
7 | 5 | A simple Article model for testing |
… |
… |
class Article(models.Model):
|
20 | 18 | |
21 | 19 | class Count(models.Model): |
22 | 20 | num = models.PositiveSmallIntegerField() |
| 21 | |
| 22 | |
| 23 | class Event(models.Model): |
| 24 | date = models.DateTimeField(auto_now_add=True) |
| 25 | |
| 26 | class Location(models.Model): |
| 27 | event = models.OneToOneField(Event, verbose_name='event') |
diff --git a/tests/regressiontests/admin_util/tests.py b/tests/regressiontests/admin_util/tests.py
index 5ea0ac5..2169e05 100644
a
|
b
|
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
|
12 | 12 | from django.contrib.sites.models import Site |
13 | 13 | from django.contrib.admin.util import NestedObjects |
14 | 14 | |
15 | | from models import Article, Count |
| 15 | from models import Article, Count, Event, Location |
16 | 16 | |
17 | 17 | |
18 | 18 | class NestedObjectsTests(TestCase): |
… |
… |
class UtilTests(unittest.TestCase):
|
220 | 220 | ), |
221 | 221 | ("not Really the Model", MockModelAdmin.test_from_model) |
222 | 222 | ) |
| 223 | |
| 224 | def test_related_name(self): |
| 225 | """ |
| 226 | Regression test for #13963: |
| 227 | """ |
| 228 | class EventAdmin(admin.ModelAdmin): |
| 229 | list_display = ('date', 'location', 'organiser') # Reverse OneToOneField lookup |
| 230 | admin.site.register(Event, EventAdmin) |
| 231 | |
| 232 | self.assertEquals( |
| 233 | label_for_field('location', Event, None, True), |
| 234 | ('location', None), |
| 235 | ) |
| 236 | |
| 237 | self.assertEquals( |
| 238 | label_for_field('event', Location, None, True), |
| 239 | ('event', None), |
| 240 | ) |
| 241 | No newline at end of file |