Browse Source

Fix 500 when module class cannot be loaded #2

Denis K 9 years ago
parent
commit
4204469a39
1 changed files with 8 additions and 3 deletions
  1. 8 3
      jet/models.py

+ 8 - 3
jet/models.py

@@ -57,9 +57,14 @@ class UserDashboardModule(models.Model):
         return self.module
 
     def load_module(self):
-        package, module_name = self.module.rsplit('.', 1)
-        package = import_module(package)
-        module = getattr(package, module_name)
+        try:
+            package, module_name = self.module.rsplit('.', 1)
+            package = import_module(package)
+            module = getattr(package, module_name)
+
+            return module
+        except AttributeError:
+            return None
 
         return module