Beispiel #1
0
    def handle(self, *args, **options):
        paths = [['%s/frontend/templates/frontend' % settings.PROJECT_ROOT, 'frontend/'],
                 ['%s/frontend/templates/ajax_frontend' % settings.PROJECT_ROOT, 'ajax_frontend/'],
                 ['%s/templates' % settings.PROJECT_ROOT, '']]

        for path in paths:
            for item in os.listdir(path[0]):
                try:
                    name = '%s%s' % (path[1], item)
                    if SiteTemplate.objects.filter(name=name).exists():
                        continue

                    content = ex_find_template(name, ['common.loaders.load_template_source'])[0]
                    SiteTemplate.objects.create(user_id=1,name=name, content = content)
                except BaseException, e:
                    logger.debug('tmpl not found %s' % e)
Beispiel #2
0
 def recovery(self, request, queryset):
     for item in queryset:
         item.content = ex_find_template(item.name, ['common.loaders.load_template_source'])[0]
         item.state = True
         item.save()
Beispiel #3
0
 def recovery(self, request, queryset):
     for item in queryset:
         item.content = ex_find_template(
             item.name, ['common.loaders.load_template_source'])[0]
         item.state = True
         item.save()