-
-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SimpleHistoryAdmin to consistently use AUTH_USER_MODEL in history…
…_view
- Loading branch information
Showing
6 changed files
with
159 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -598,6 +598,24 @@ def test_model_with_excluded_fields(self): | |
self.assertEqual(most_recent.question, p.question) | ||
self.assertEqual(most_recent.place, p.place) | ||
|
||
def test_history_user_model_is_auth_user_as_default(self): | ||
self.assertEqual( | ||
get_user_model(), | ||
get_history_model_for_model(Poll)._history_user_model | ||
) | ||
|
||
def test_history_user_model_is_user_model_on_override(self): | ||
self.assertEqual( | ||
BucketMember, | ||
get_history_model_for_model(BucketData)._history_user_model | ||
) | ||
|
||
def test_history_user_model_is_user_model_on_override_register(self): | ||
self.assertEqual( | ||
BucketMember, | ||
get_history_model_for_model(BucketDataRegisterChangedBy)._history_user_model | ||
) | ||
|
||
def test_user_model_override(self): | ||
user1 = User.objects.create_user("user1", "[email protected]") | ||
user2 = User.objects.create_user("user2", "[email protected]") | ||
|
@@ -2292,6 +2310,11 @@ def test_history_user_does_not_exist(self): | |
self.assertEqual(user_id, instance.history.first().history_user_id) | ||
self.assertIsNone(instance.history.first().history_user) | ||
|
||
def test_history_user_model_is_auth_user(self): | ||
self.assertEqual( | ||
get_user_model(), | ||
get_history_model_for_model(ExternalModelWithCustomUserIdField)._history_user_model | ||
) | ||
|
||
class RelatedNameTest(TestCase): | ||
def setUp(self): | ||
|