Commit b3c47f2f authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

raise exception when no functional categories available yet

parent 09458ad3
Pipeline #19640 passed with stages
in 2 minutes and 26 seconds
...@@ -24,6 +24,8 @@ class ImportEggNog(object): ...@@ -24,6 +24,8 @@ class ImportEggNog(object):
def _build_functional_category_dict(self): def _build_functional_category_dict(self):
all_categories = EggNogFunctionalCategory.objects.all() all_categories = EggNogFunctionalCategory.objects.all()
if not all_categories:
raise Exception("You need to create Functional categories first.")
self.functional_cat = {cat.category_id: cat for cat in all_categories} self.functional_cat = {cat.category_id: cat for cat in all_categories}
def link_functional_category(self, eggnog_dict): def link_functional_category(self, eggnog_dict):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment