diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-08-17 16:11:58 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-08-17 16:11:58 +0200 |
commit | a08a9104888ab9ed68b288b2ccf68a24a40ed761 (patch) | |
tree | f5951ac699ff60c05cae9cc8cd0e026080f17c52 /archaeological_files/models.py | |
parent | d9778c94e640061a74aae4cb5eb21b349c553b1c (diff) | |
download | Ishtar-a08a9104888ab9ed68b288b2ccf68a24a40ed761.tar.bz2 Ishtar-a08a9104888ab9ed68b288b2ccf68a24a40ed761.zip |
File: don't get history for closing if there is no history
Diffstat (limited to 'archaeological_files/models.py')
-rw-r--r-- | archaeological_files/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 1910de7d6..8e871e000 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -314,7 +314,10 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, def closing(self): if self.is_active(): return - for item in self.history.all(): + q = self.history + if not q.count(): + return {'date':None, 'user':None} + for item in q.all(): if not item.end_date: break return {'date':item.history_date, |