Fixes in asuers
This commit is contained in:
parent
6ac5cd8e84
commit
f86a393921
1 changed files with 26 additions and 3 deletions
|
|
@ -3,9 +3,15 @@
|
|||
from paramecio.modules.admin.models.admin import UserAdmin
|
||||
from paramecio.citoplasma.urls import make_url
|
||||
from paramecio.citoplasma.generate_admin_class import GenerateAdminClass
|
||||
from paramecio.citoplasma.i18n import I18n
|
||||
from paramecio2.libraries.i18n import I18n, PGetText
|
||||
from paramecio.cromosoma.coreforms import SelectForm
|
||||
from paramecio.citoplasma.sessions import get_session
|
||||
from settings import config
|
||||
from bottle import request
|
||||
|
||||
pgettext=PGetText(__file__+'/../')
|
||||
|
||||
_=pgettext.gettext
|
||||
|
||||
def admin(**args):
|
||||
|
||||
|
|
@ -17,10 +23,14 @@ def admin(**args):
|
|||
|
||||
user_admin.fields['privileges'].name_form=SelectForm
|
||||
|
||||
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang'])
|
||||
user_admin.fields['theme'].name_form=SelectForm
|
||||
|
||||
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'theme'])
|
||||
|
||||
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['theme'].arr_select={0: _('Light theme'), 1: _('Dark theme')}
|
||||
|
||||
user_admin.fields['password'].protected=False
|
||||
|
||||
url=make_url('admin/ausers', {})
|
||||
|
|
@ -31,7 +41,20 @@ def admin(**args):
|
|||
|
||||
admin.list.search_fields=['username']
|
||||
|
||||
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'privileges', 'lang']
|
||||
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'privileges', 'lang', 'theme']
|
||||
|
||||
#if reqes
|
||||
if request.environ.get('REQUEST_METHOD', 'POST')=='POST':
|
||||
s=get_session()
|
||||
theme=request.forms.get('theme', '0')
|
||||
|
||||
if theme!='0' and theme!='1':
|
||||
theme='0'
|
||||
|
||||
s['theme']=str(theme)
|
||||
|
||||
s.save()
|
||||
|
||||
|
||||
#admin.list.limit_pages=5
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue