close #1 Added new enhacenment
This commit is contained in:
parent
693c6754e1
commit
45fd250a25
5 changed files with 38 additions and 6 deletions
|
|
@ -63,6 +63,8 @@ class GenerateAdminClass:
|
|||
|
||||
edit_forms=OrderedDict()
|
||||
|
||||
url_action=self.url
|
||||
|
||||
for key_form in self.arr_fields_edit:
|
||||
edit_forms[key_form]=self.model.forms[key_form]
|
||||
|
||||
|
|
@ -119,6 +121,8 @@ class GenerateAdminClass:
|
|||
set_flash_message(I18n.lang('common', 'task_successful', 'Task successful'))
|
||||
redirect(self.url)
|
||||
else:
|
||||
url_action=add_get_parameters(self.url, op_admin=2, id=getpostfiles.get['id'])
|
||||
|
||||
form=show_form(getpostfiles.post, edit_forms, self.t, True)
|
||||
return self.t.render_template(self.template_insert, admin=self, title_edit=title_edit, form=form, model=self.model, id=getpostfiles.get['id'], url_action=url_action)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from importlib import import_module
|
||||
from paramecio.citoplasma.sessions import get_session
|
||||
import json
|
||||
|
||||
yes_session=False
|
||||
|
||||
|
|
@ -62,4 +63,12 @@ class I18n:
|
|||
|
||||
return I18n.l[lang][module][symbol]
|
||||
|
||||
@staticmethod
|
||||
def extract_value(value):
|
||||
|
||||
value=json.loads(value)
|
||||
|
||||
lang=I18n.get_default_lang()
|
||||
|
||||
return value[lang]
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ choose=''
|
|||
% endfor
|
||||
% endif
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$(".${name_form}_i18n_flag").click(function () {
|
||||
|
|
@ -64,14 +65,13 @@ $(".${name_form}_i18n_flag").closest('form').submit( function () {
|
|||
|
||||
$(".${name_form}_i18n_form").each(function () {
|
||||
|
||||
var lang=$(this).attr('id').replace('text_','').replace('_switch', '');
|
||||
var lang=$(this).attr('id').replace('${name_form}_','').replace('_switch', '');
|
||||
|
||||
var child_input=$('#${name_form}_'+lang+'_form');
|
||||
|
||||
arr_i18n[lang]=child_input.val();
|
||||
|
||||
});
|
||||
|
||||
//$("#${name_form}_i18n_value").val(JSON.stringify(arr_i18n));
|
||||
//$("#${name_form}_i18n_value").attr('value', JSON.stringify(arr_i18n));
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class I18nField(PhangoField):
|
|||
arr_real_values[lang]=arr_values.get(lang, '')
|
||||
arr_real_values[lang]=self.check_value(arr_real_values[lang])
|
||||
|
||||
self.error=False
|
||||
|
||||
arr_values=arr_real_values
|
||||
|
||||
if arr_values[I18n.default_lang]=='':
|
||||
|
|
|
|||
|
|
@ -332,6 +332,10 @@ class WebModel:
|
|||
|
||||
self.create_fields()
|
||||
|
||||
# property for use show_formatted property if needed
|
||||
|
||||
self.show_formatted=False
|
||||
|
||||
# A method where create the new fields of this model
|
||||
|
||||
def create_fields(self):
|
||||
|
|
@ -664,6 +668,11 @@ class WebModel:
|
|||
|
||||
if row==None:
|
||||
row=False
|
||||
else:
|
||||
if self.show_formatted:
|
||||
for k, col in row.items():
|
||||
row[k]=self.fields[k].show_formatted(col)
|
||||
|
||||
|
||||
return row
|
||||
|
||||
|
|
@ -677,6 +686,10 @@ class WebModel:
|
|||
|
||||
if row==None:
|
||||
row=False
|
||||
else:
|
||||
if self.show_formatted:
|
||||
for k, col in row.items():
|
||||
row[k]=self.fields[k].show_formatted(col)
|
||||
|
||||
return row
|
||||
|
||||
|
|
@ -708,6 +721,10 @@ class WebModel:
|
|||
with self.select(fields_selected, raw_query) as cursor:
|
||||
for row in cursor:
|
||||
|
||||
if self.show_formatted and row:
|
||||
for k, col in row.items():
|
||||
row[k]=self.fields[k].show_formatted(col)
|
||||
|
||||
results.append(row)
|
||||
|
||||
del_row_id(results)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue