mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
added fix for OneToOneRel error happening in case of Polymorphic model (#429)
This commit is contained in:
parent
d74c118834
commit
a56d0e6f78
3 changed files with 6 additions and 2 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
- fix: Display `created` timestamp in server timezone ([#404](https://github.com/jazzband/django-auditlog/pull/404))
|
||||
- fix: Handle port in `remote_addr` ([#417](https://github.com/jazzband/django-auditlog/pull/417))
|
||||
- fix: Handle the error with AttributeError: 'OneToOneRel' error occur during a `PolymorphicModel` has relation with other models ([#429](https://github.com/jazzband/django-auditlog/pull/429))
|
||||
|
||||
## 2.1.1 (2022-07-27)
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,11 @@ def get_field_value(obj, field):
|
|||
else:
|
||||
value = smart_str(getattr(obj, field.name, None))
|
||||
except ObjectDoesNotExist:
|
||||
value = field.default if field.default is not NOT_PROVIDED else None
|
||||
value = (
|
||||
field.default
|
||||
if getattr(field, "default", NOT_PROVIDED) is not NOT_PROVIDED
|
||||
else None
|
||||
)
|
||||
|
||||
return value
|
||||
|
||||
|
|
|
|||
|
|
@ -1145,7 +1145,6 @@ class ChoicesFieldModelTest(TestCase):
|
|||
)
|
||||
|
||||
def test_changes_display_dict_single_choice(self):
|
||||
|
||||
self.assertEqual(
|
||||
self.obj.history.latest().changes_display_dict["status"][1],
|
||||
"Red",
|
||||
|
|
|
|||
Loading…
Reference in a new issue