diff options
| -rw-r--r-- | ishtar_common/models.py | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 610d92551..674e42538 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1179,8 +1179,11 @@ class BaseHistorizedItem(FullSearch, Imported, JsonData, FixAssociated):          historized = self.history.all()          item = None          if step: -            assert len(historized) > step -            item = historized[step] +            if len(historized) <= step: +                # silently return the last step if too far in the history +                item = historized[len(historized) - 1] +            else: +                item = historized[step]          else:              for step, item in enumerate(historized):                  if item.history_date == date: | 
