@classmethod
def lookup(cls):
    for d in os.listdir(cls.template_dir):
        full_path = os.path.join(cls.template_dir, d)
        meta_path = os.path.join(full_path, 'meta.yml')
        if ((not os.path.isdir(full_path)) or (not os.path.isfile(meta_path))):
            continue
        with open(meta_path) as f:
            metadata = yaml.load(f)
        defaults = {'name': d, 'meta': metadata}
        cls.objects.update_or_create(defaults=defaults, name=d)
@classmethod
def lookup(cls):
    for d in os.listdir(cls.template_dir):
        full_path = os.path.join(cls.template_dir, d)
        meta_path = os.path.join(full_path, 'meta.yml')
        if ((not os.path.isdir(full_path)) or (not os.path.isfile(meta_path))):
            continue
        with open(meta_path) as f:
            metadata = yaml.load(f)
        defaults = {'name': d, 'meta': metadata}
        cls.objects.update_or_create(defaults=defaults, name=d)