Skip to content

Commit ead287a

Browse files
author
Ross Mechanic
authored
Fix custom user bug and update to 2.5.1 (#460)
* Fix custom user bug and update to 2.5.1 * Empty commit to retry codecov
1 parent 3b7a3fd commit ead287a

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

CHANGES.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
Changes
22
=======
33

4-
Unreleased
5-
-----------
4+
2.5.1 (2018-10-19)
5+
------------------
66
- Add `'+'` as the `history_type` for each instance in `bulk_history_create` (gh-449)
77
- Add support for `history_change_reason` for each instance in `bulk_history_create` (gh-449)
8-
- Add `history_change_reason` in the history list view under the `Change reason` display name
8+
- Add `history_change_reason` in the history list view under the `Change reason` display name (gh-458)
9+
- Fix bug that caused failures when using a custom user model (gh-459)
910

1011
2.5.0 (2018-10-18)
1112
------------------

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.5.0
2+
current_version = 2.5.1
33
commit = True
44
tag = True
55
tag_name = {new_version}

simple_history/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import unicode_literals
22

3-
__version__ = '2.5.0'
3+
__version__ = '2.5.1'
44

55

66
def register(

simple_history/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
from django.apps import apps
99
from django.conf import settings
1010
from django.contrib import admin
11-
from django.contrib.auth import get_user_model
12-
from django.db import models, router
11+
from django.db import models
1312
from django.db.models import Q
1413
from django.db.models.fields.proxy import OrderWrt
1514
from django.urls import reverse
@@ -26,7 +25,6 @@
2625
post_create_historical_record,
2726
)
2827

29-
User = get_user_model()
3028
registered_models = {}
3129

3230

@@ -220,7 +218,9 @@ def copy_fields(self, model):
220218
def get_extra_fields(self, model, fields):
221219
"""Return dict of extra fields added to the historical record model"""
222220

223-
user_model = self.user_model or User
221+
user_model = self.user_model or getattr(
222+
settings, 'AUTH_USER_MODEL', 'auth.User'
223+
)
224224

225225
def revert_url(self):
226226
"""URL for this change in the default admin site."""

0 commit comments

Comments
 (0)