def loadWidgets(self): from domoweb.models import Widget root = self.project['packs']['widgets']['root'] # List available widgets Widget.objects.all().delete() if os.path.isdir(root): for file in os.listdir(root): if not file.startswith('.'): # not hidden file main = os.path.join(root, file, "main.js") if os.path.isfile(main): w = Widget(id=file) w.save()