Skip to content

Commit 086fdc4

Browse files
author
Ross Mechanic
committed
Added test case and updated changes file
1 parent 67145ff commit 086fdc4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGES.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Unreleased
66
- Use get_queryset rather than model.objects in history_view. (gh-303)
77
- Change ugettext calls in models.py to ugettext_lazy
88
- Resolve issue where model references itself (gh-278)
9-
- History models for inherited models will be located in the same module as the inherited model
9+
- Fix issue with tracking an inherited model (abstract class) (gh-269)
10+
- Resolve issue where model references itself (gh-278)
1011

1112
1.9.0 (2017-06-11)
1213
------------------

simple_history/tests/tests/test_models.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515

1616
from ..external.models import ExternalModel2, ExternalModel4
1717
from ..models import (AbstractBase, AdminProfile, Book, Bookcase, Choice, City,
18-
ConcreteAttr, ConcreteUtil, Contact, ContactRegister,
18+
ConcreteAttr, ConcreteExternal, ConcreteUtil, Contact, ContactRegister,
1919
Country, Document, Employee, ExternalModel1,
2020
ExternalModel3, FileModel, HistoricalChoice,
2121
HistoricalCustomFKError, HistoricalPoll, HistoricalState,
2222
Library, MultiOneToOne, Person, Poll, PollInfo,
2323
PollWithExcludeFields, Province, Restaurant, SelfFK,
2424
Series, SeriesWork, State, Temperature,
2525
UnicodeVerboseName, WaterLevel)
26-
from django.apps import apps
2726

2827
get_model = apps.get_model
2928
User = get_user_model()
@@ -418,6 +417,13 @@ def test_get_model(self):
418417
self.assertEqual(get_model('tests', 'HistoricalExternalModel4'),
419418
ExternalModel4.histories.model)
420419

420+
# Test that historical model is defined within app of concrete
421+
# model rather than abstract base model
422+
self.assertEqual(get_model('tests', 'ConcreteExternal'),
423+
ConcreteExternal)
424+
self.assertEqual(get_model('tests', 'HistoricalConcreteExternal'),
425+
ConcreteExternal.history.model)
426+
421427

422428
class HistoryManagerTest(TestCase):
423429
def test_most_recent(self):

0 commit comments

Comments
 (0)