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)
|
#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)
|
||||||
@app.get('/'+config.admin_folder+'/<module>')
|
@app.get('/'+config.admin_folder+'/<module>')
|
||||||
@app.post('/'+config.admin_folder+'/<module>')
|
@app.post('/'+config.admin_folder+'/<module>')
|
||||||
@app.get('/'+config.admin_folder+'/<module>/<submodule>')
|
@app.get('/'+config.admin_folder+'/<module>/<submodule>')
|
||||||
@app.post('/'+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
|
# 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
|
#Fix, make local variable
|
||||||
|
|
||||||
t=PTemplate(env)
|
|
||||||
|
|
||||||
t.add_filter(make_admin_url)
|
t.add_filter(make_admin_url)
|
||||||
|
|
||||||
t.show_basic_template=True
|
t.show_basic_template=True
|
||||||
|
|
@ -118,8 +126,14 @@ def home(module='', submodule=''):
|
||||||
|
|
||||||
#t.env=t.env_theme(path.dirname(__file__))
|
#t.env=t.env_theme(path.dirname(__file__))
|
||||||
|
|
||||||
t.env.directories.insert(1, path.dirname(module_imported[module].__file__).replace('/admin', '')+'/templates')
|
templates_path=path.dirname(module_imported[module].__file__).replace('/admin', '')+'/templates'
|
||||||
#print(t.env.directories)
|
|
||||||
|
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:
|
#if config.reloader:
|
||||||
#reload(new_module)
|
#reload(new_module)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,27 @@ class TestWebModelMethods(unittest.TestCase):
|
||||||
|
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
def test_functions(self):
|
||||||
|
|
||||||
|
print('Test functions')
|
||||||
|
|
||||||
|
connection=WebModel.connection()
|
||||||
|
model=ExampleModel(connection)
|
||||||
|
|
||||||
|
sql=model.create_table()
|
||||||
|
|
||||||
|
self.assertTrue(model.query(sql))
|
||||||
|
|
||||||
|
cur=model.set_conditions('where id=%s', [4]).select()
|
||||||
|
|
||||||
|
self.assertTrue(cur)
|
||||||
|
|
||||||
|
cur.close()
|
||||||
|
|
||||||
|
self.assertTrue(model.drop())
|
||||||
|
|
||||||
|
connection.close()
|
||||||
|
|
||||||
def test_zcheck_1_foreignkeys(self):
|
def test_zcheck_1_foreignkeys(self):
|
||||||
|
|
||||||
connection=WebModel.connection()
|
connection=WebModel.connection()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue