diff --git a/commands/newapp.py b/commands/newapp.py index 2cc51d3b9e1703a06784fe4272a500a8653f62c0..905990a3a41c026b5f28220f3b1d579f5de3233f 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 763fc025af21e061e82fad8c0c7100f71b68cd7b..48d410aa4eb864ea6386d840801c9be8d65334fe 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 58bda518d0ba5da9c7923b583d2bfd5d76264180..f19b6125c806fb7c3e9cc88f4cf0bb5cc17e3f20 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 _