From 1374963d15fa8ae40cb79def330eec0844359af7 Mon Sep 17 00:00:00 2001 From: Dmitry Volodin Date: Fri, 9 Aug 2019 12:00:16 +0300 Subject: [PATCH] Fix ./noc newapp --- commands/newapp.py | 4 ++-- templates/newapp/modelapplication/js/Application.js.j2 | 2 +- templates/newapp/modelapplication/views.py.j2 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/newapp.py b/commands/newapp.py index 2cc51d3b9e..905990a3a4 100644 --- a/commands/newapp.py +++ b/commands/newapp.py @@ -15,9 +15,9 @@ import re # Third-party modules import six -from django.template import Template, Context from django.db.models.fields import NOT_PROVIDED from django.db.models import Model +from jinja2 import Template # NOC modules from noc.core.management.base import BaseCommand, CommandError @@ -296,7 +296,7 @@ class Command(BaseCommand): # Fill template with open(os.path.join(dirpath, fn)) as f: template = f.read() - content = Template(template).render(Context(tv)) + content = Template(template).render(tv) content = self.compact(content) # Write template if fn.endswith(".js.j2"): diff --git a/templates/newapp/modelapplication/js/Application.js.j2 b/templates/newapp/modelapplication/js/Application.js.j2 index 763fc025af..48d410aa4e 100644 --- a/templates/newapp/modelapplication/js/Application.js.j2 +++ b/templates/newapp/modelapplication/js/Application.js.j2 @@ -9,7 +9,7 @@ console.debug("Defining NOC.{{module}}.{{app}}.Application"); Ext.define("NOC.{{module}}.{{app}}.Application", { extend: "NOC.core.ModelApplication", requires: [ - {%for r in requires%}"{{r}}"{% if forloop.last %}{%else%}, + {%for r in requires%}"{{r}}"{% if loop.last %}{%else%}, {%endif%}{%endfor%} ], diff --git a/templates/newapp/modelapplication/views.py.j2 b/templates/newapp/modelapplication/views.py.j2 index 58bda518d0..f19b6125c8 100644 --- a/templates/newapp/modelapplication/views.py.j2 +++ b/templates/newapp/modelapplication/views.py.j2 @@ -7,7 +7,7 @@ # ---------------------------------------------------------------------- # NOC modules -from noc.lib.app import {{base_class}}, view +from noc.lib.app.extdocapplication import {{base_class}}, view from {{modelimport}} import {{model}} from noc.core.translation import ugettext as _ -- GitLab