diff --git a/AUTHORS.rst b/AUTHORS.rst index a1663243c..cdbdb09fb 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -49,6 +49,7 @@ Authors - Hamish Downer - Hanyin Zhang - Hernan Esteves (`sevetseh28 `_) +- Hielke Walinga (`hwalinga `_) - Jack Cushman (`jcushman `_) - James Muranga (`jamesmura `_) - James Pulec diff --git a/simple_history/models.py b/simple_history/models.py index 6f0aba37e..ffdac118b 100644 --- a/simple_history/models.py +++ b/simple_history/models.py @@ -579,6 +579,8 @@ def __init__(self, model, fields_included): self.fields_included = fields_included def __get__(self, instance, owner): + if instance is None: + return self values = {f.attname: getattr(instance, f.attname) for f in self.fields_included} return self.model(**values)