diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-10-22 13:59:09 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-10-22 13:59:09 +0200 |
commit | 03b0dbd17b7c0e09db960048d89e59092d119753 (patch) | |
tree | bfebf3cefb7a8a2e606462a87337146d4d764a58 /ishtar_common/data_importer.py | |
parent | 398a928d10f93bcf92be97e7ecca3638e5a27362 (diff) | |
download | Ishtar-03b0dbd17b7c0e09db960048d89e59092d119753.tar.bz2 Ishtar-03b0dbd17b7c0e09db960048d89e59092d119753.zip |
Importers: allow the deletion of specific importers on generation
Diffstat (limited to 'ishtar_common/data_importer.py')
-rw-r--r-- | ishtar_common/data_importer.py | 6 |
1 files changed, 4 insertions, 2 deletions
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__ + '.' + \ |