Fixes in coreforms and ausers

This commit is contained in:
absurdo 2023-10-09 17:56:56 +02:00
parent deeec158d6
commit 7f1a3adf22
3 changed files with 8 additions and 4 deletions

View file

@ -42,12 +42,13 @@ class BaseForm:
self.error=False self.error=False
self.name_field_id=self.name+'_form' self.name_field_id=self.name+'_form'
self.help='' self.help=''
self.placeholder=''
def form(self): def form(self):
"""Method for returm the html code of the form """Method for returm the html code of the form
""" """
return '<input type="'+self.type+'" class="'+self.css+'" name="'+self.name+'" id="'+self.name_field_id+'" value="'+self.setform(self.default_value)+'" />' return '<input type="'+self.type+'" class="'+self.css+'" name="'+self.name+'" id="'+self.name_field_id+'" value="'+self.setform(self.default_value)+'" placeholder="'+self.placeholder+'" />'
def show_formatted(self, value): def show_formatted(self, value):
"""Method for show the value of form formatted """Method for show the value of form formatted

View file

@ -4,6 +4,7 @@ from paramecio2.modules.admin.models.admin import UserAdmin
from paramecio2.libraries.generate_admin_class import GenerateAdminClass from paramecio2.libraries.generate_admin_class import GenerateAdminClass
from paramecio2.libraries.i18n import I18n from paramecio2.libraries.i18n import I18n
from paramecio2.libraries.db.coreforms import SelectForm from paramecio2.libraries.db.coreforms import SelectForm
from paramecio2.libraries.db.coreforms import HiddenForm
import copy import copy
from paramecio2.modules.admin import admin_app, t as admin_t from paramecio2.modules.admin import admin_app, t as admin_t
@ -22,7 +23,9 @@ def ausers():
user_admin.fields['double_auth'].name_form=SelectForm user_admin.fields['double_auth'].name_form=SelectForm
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'disabled', 'double_auth']) user_admin.fields['last_login'].name_form=HiddenForm
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'disabled', 'double_auth', 'last_login'])
user_admin.forms['privileges'].arr_select={0: I18n.lang('admin', 'without_privileges', 'Without privileges'), 1: I18n.lang('admin', 'selected_privileges', 'Selected privileges'), 2: I18n.lang('admin', 'administrator', 'Administrator')} user_admin.forms['privileges'].arr_select={0: I18n.lang('admin', 'without_privileges', 'Without privileges'), 1: I18n.lang('admin', 'selected_privileges', 'Selected privileges'), 2: I18n.lang('admin', 'administrator', 'Administrator')}
@ -43,7 +46,7 @@ def ausers():
admin.list.search_fields=['username'] admin.list.search_fields=['username']
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'lang', 'double_auth', 'disabled'] admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'lang', 'double_auth', 'disabled', 'last_login']
form_admin=admin.show() form_admin=admin.show()

View file

@ -13,7 +13,7 @@ if sys.version_info < (3, 8):
# If you install passlib and bcrypt, the password system will use bcrypt by default, if not, will use native crypt libc # If you install passlib and bcrypt, the password system will use bcrypt by default, if not, will use native crypt libc
setup(name='paramecio2', setup(name='paramecio2',
version='2.0.22', version='2.0.23',
description='Simple Web Framework based in flask and Mako.', description='Simple Web Framework based in flask and Mako.',
long_description='This framework is a simple framework used for create web apps. Paramecio is modular and fast. By default have a module called admin that can be used for create admin sites', long_description='This framework is a simple framework used for create web apps. Paramecio is modular and fast. By default have a module called admin that can be used for create admin sites',
author='Antonio de la Rosa Caballero', author='Antonio de la Rosa Caballero',