From 03b0dbd17b7c0e09db960048d89e59092d119753 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 22 Oct 2015 13:59:09 +0200 Subject: Importers: allow the deletion of specific importers on generation --- ishtar_common/data_importer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ishtar_common/data_importer.py') diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 5f70d81e3..1a77c2546 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -617,11 +617,13 @@ class Importer(object): 'regex_not_match': _(u"The regexp doesn't match.") } - def _create_models(self): + def _create_models(self, force=False): from ishtar_common import models q = models.ImporterType.objects.filter(slug=self.SLUG) - if not self.SLUG or q.count(): + if not force and (not self.SLUG or q.count()): return + if force and q.count(): + q.all()[0].delete() name = self.NAME if self.NAME else self.SLUG model_name = self.OBJECT_CLS.__module__ + '.' + \ -- cgit v1.2.3