New feature for templates paths
This commit is contained in:
parent
7f15296d81
commit
ac785f904c
2 changed files with 40 additions and 5 deletions
|
|
@ -60,12 +60,22 @@ for k, v in menu.items():
|
|||
|
||||
#print(d)
|
||||
|
||||
t=PTemplate(env)
|
||||
|
||||
num_template=1
|
||||
|
||||
if hasattr(config, 'admin_templates_index'):
|
||||
|
||||
t.env.directories.insert(num_template, config.admin_templates_index)
|
||||
num_template+=1
|
||||
|
||||
|
||||
@app.get('/'+config.admin_folder)
|
||||
@app.get('/'+config.admin_folder+'/<module>')
|
||||
@app.post('/'+config.admin_folder+'/<module>')
|
||||
@app.get('/'+config.admin_folder+'/<module>/<submodule>')
|
||||
@app.post('/'+config.admin_folder+'/<module>/<submodule>')
|
||||
def home(module='', submodule=''):
|
||||
def home(module='', submodule='', t=t):
|
||||
|
||||
# A simple boolean used for show or not the code of admin module in standard template
|
||||
|
||||
|
|
@ -74,8 +84,6 @@ def home(module='', submodule=''):
|
|||
|
||||
#Fix, make local variable
|
||||
|
||||
t=PTemplate(env)
|
||||
|
||||
t.add_filter(make_admin_url)
|
||||
|
||||
t.show_basic_template=True
|
||||
|
|
@ -118,8 +126,14 @@ def home(module='', submodule=''):
|
|||
|
||||
#t.env=t.env_theme(path.dirname(__file__))
|
||||
|
||||
t.env.directories.insert(1, path.dirname(module_imported[module].__file__).replace('/admin', '')+'/templates')
|
||||
#print(t.env.directories)
|
||||
templates_path=path.dirname(module_imported[module].__file__).replace('/admin', '')+'/templates'
|
||||
|
||||
try:
|
||||
index_value = t.env.directories.index(templates_path)
|
||||
except ValueError:
|
||||
t.env.directories.insert(num_template, templates_path)
|
||||
|
||||
print(t.env.directories)
|
||||
#if config.reloader:
|
||||
#reload(new_module)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue