From 2d004a024300d7c33111e57c5c9365db67af6224 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 2 Oct 2017 19:55:16 +0200 Subject: set_localisation: do not raise an error for an empty value if localisation is not defined --- archaeological_finds/models_finds.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'archaeological_finds/models_finds.py') diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 811e6be74..891d99d28 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1075,11 +1075,13 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel, def set_localisation(self, place, context, value): if not self.container: + if not value: + return raise ImporterError(_(u"No container have been set - the " u"localisation cannot be set.")) localisation = self.container.set_localisation(place, value) - if not localisation: + if value and value != '-' and not localisation: raise ImporterError( unicode(_(u"The division number {} have not been set " u"for the warehouse {}.")).format( -- cgit v1.2.3