From 9a6403a5f4904bc290c7838246449c18073c84a3 Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Sat, 11 Jan 2025 01:43:48 +0100 Subject: [PATCH] FIx in ausers --- parameciofast/libraries/mtemplates.py | 4 ++-- parameciofast/modules/fastadmin/app.py | 2 +- parameciofast/modules/fastadmin/ausers.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/parameciofast/libraries/mtemplates.py b/parameciofast/libraries/mtemplates.py index 5c17342..1717346 100644 --- a/parameciofast/libraries/mtemplates.py +++ b/parameciofast/libraries/mtemplates.py @@ -97,7 +97,7 @@ class PTemplate: templates_loaded={} - def __init__(self, environment, url_for): + def __init__(self, environment): """A class used how shortcuts for Mako template functions. This class is used to have a set of shortcuts and hooks to Mako templates functions and methods over a series of default options. @@ -145,7 +145,7 @@ class PTemplate: """ - self.add_filter(url_for) + #self.add_filter(url_for) #self.add_filter(csrf_token) diff --git a/parameciofast/modules/fastadmin/app.py b/parameciofast/modules/fastadmin/app.py index 70607e6..a4ebe2b 100644 --- a/parameciofast/modules/fastadmin/app.py +++ b/parameciofast/modules/fastadmin/app.py @@ -16,7 +16,7 @@ from parameciofast.libraries.keyutils import create_key_encrypt, create_key from time import time env=env_theme(__file__) -t=PTemplate(env, app.url_path_for) +t=PTemplate(env) usermodel=UserAdmin() diff --git a/parameciofast/modules/fastadmin/ausers.py b/parameciofast/modules/fastadmin/ausers.py index afcd8dd..14c9e6c 100644 --- a/parameciofast/modules/fastadmin/ausers.py +++ b/parameciofast/modules/fastadmin/ausers.py @@ -1,6 +1,19 @@ from fastapi.responses import HTMLResponse from parameciofast.modules.fastadmin import admin_app from parameciofast.modules.fastadmin.libraries.config import modules_admin, modules_admin_icons +from parameciofast.libraries.mtemplates import PTemplate, env_theme +import os + +env=env_theme(__file__) + +t=PTemplate(env) + +#t.env.directories=admin_t.env.directories + +tpl_path=os.path.dirname(__file__).replace('/admin', '')+'/templates/admin' + +if t.env.directories[1]!=tpl_path: + t.env.directories.insert(1, tpl_path) modules_admin.append(['Admin users', 'fastadmin_ausers', 'people-circle'])