Fixes in default lang
This commit is contained in:
parent
9cd3ada7b4
commit
3596838864
6 changed files with 35 additions and 21 deletions
|
|
@ -3,9 +3,12 @@ from flask import request, redirect, flash
|
|||
from paramecio2.libraries.urls import add_get_parameters
|
||||
#from paramecio.citoplasma.mtemplates import set_flash_message
|
||||
from paramecio2.libraries.formsutils import show_form
|
||||
from paramecio2.libraries.i18n import I18n
|
||||
from paramecio2.libraries.i18n import I18n, PGetText
|
||||
from collections import OrderedDict
|
||||
|
||||
pgettext=PGetText(__file__)
|
||||
_=pgettext.gettext
|
||||
|
||||
class GenerateAdminClass:
|
||||
"""Class for insert, update and list items of a model
|
||||
"""
|
||||
|
|
@ -76,7 +79,7 @@ class GenerateAdminClass:
|
|||
|
||||
self.post_update=None
|
||||
|
||||
self.text_home=I18n.lang('common', 'home', 'Home')
|
||||
self.text_home=_('Home')
|
||||
|
||||
def show(self):
|
||||
""" Method for show the admin model
|
||||
|
|
@ -106,13 +109,13 @@ class GenerateAdminClass:
|
|||
|
||||
post=None
|
||||
|
||||
title_edit=I18n.lang('common', 'add_new_item', 'Add new item')
|
||||
title_edit=_('Add new item')
|
||||
|
||||
pass_value=False
|
||||
|
||||
if item_id!='0':
|
||||
post=self.model.select_a_row(item_id, [], True)
|
||||
title_edit=I18n.lang('common', 'edit_new_item', 'Edit item')
|
||||
title_edit=_('Edit item')
|
||||
pass_value=True
|
||||
|
||||
if post==None or post==False:
|
||||
|
|
@ -149,12 +152,12 @@ class GenerateAdminClass:
|
|||
|
||||
item_id='0'
|
||||
|
||||
title_edit=I18n.lang('common', 'add_new_item', 'Add new item')
|
||||
title_edit=_('Add new item')
|
||||
|
||||
|
||||
if item_id!='0':
|
||||
insert_row=self.model.update
|
||||
title_edit=I18n.lang('common', 'edit_new_item', 'Edit item')
|
||||
title_edit=_('Edit item')
|
||||
self.model.conditions=['WHERE `'+self.model.name+'`.`'+self.model.name_field_id+'`=%s', [item_id]]
|
||||
|
||||
post=dict(request.form)
|
||||
|
|
@ -162,7 +165,7 @@ class GenerateAdminClass:
|
|||
if pre_update_ret:
|
||||
|
||||
if insert_row(post):
|
||||
flash(I18n.lang('common', 'task_successful', 'Task successful'))
|
||||
flash(_('Task successful'))
|
||||
|
||||
if self.post_update:
|
||||
if item_id=='0':
|
||||
|
|
@ -203,7 +206,7 @@ class GenerateAdminClass:
|
|||
if item_id!='0':
|
||||
self.model.conditions=['WHERE `'+self.model.name+'`.`'+self.model.name_field_id+'`=%s', [item_id]]
|
||||
self.model.delete()
|
||||
flash(I18n.lang('common', 'task_successful', 'Task successful'))
|
||||
flash(_('Task successful'))
|
||||
return redirect(self.url_redirect)
|
||||
|
||||
else:
|
||||
|
|
@ -282,7 +285,7 @@ class GenerateConfigClass:
|
|||
|
||||
self.post_update=None
|
||||
|
||||
self.text_home=I18n.lang('common', 'home', 'Home')
|
||||
self.text_home=_('Home')
|
||||
|
||||
def show(self):
|
||||
|
||||
|
|
@ -298,7 +301,7 @@ class GenerateConfigClass:
|
|||
|
||||
self.model.create_forms()
|
||||
|
||||
title_edit=I18n.lang('common', 'edit', 'Edit')+' '+self.title_name
|
||||
title_edit=_('Edit')+' '+self.title_name
|
||||
|
||||
edit_forms=OrderedDict()
|
||||
|
||||
|
|
@ -323,7 +326,7 @@ class GenerateConfigClass:
|
|||
post=dict(request.form)
|
||||
|
||||
if insert_model(post):
|
||||
set_flash_message(I18n.lang('common', 'task_successful', 'Task successful'))
|
||||
set_flash_message(_('Task successful'))
|
||||
self.model.yes_reset_conditions=True
|
||||
|
||||
if self.post_update:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue