From 4dd825e22c77df37f06db6a06b96e07be5d220c3 Mon Sep 17 00:00:00 2001 From: "Denis V. Dedkov" Date: Fri, 19 Jun 2015 20:18:13 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Редактирование по клику 2. Текст после сохранения 3. Текст пустой ячейки --- asuzr/tables.py | 8 ++++---- record/settings.py | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/asuzr/tables.py b/asuzr/tables.py index e94b15f..34bf073 100644 --- a/asuzr/tables.py +++ b/asuzr/tables.py @@ -14,18 +14,19 @@ class EditableColumn(tables.TemplateColumn): {main_part} ''' main_part = '' + params = 'auto_height = 1, auto_width = 1' if object_name == '': main_part = ''' - {{% inplace_edit "record.{field}" auto_height = 1, auto_width = 1 %}} + {{% inplace_edit "record.{field}" {params} %}} ''' else: main_part = ''' {{% if record.{object_name} %}} - {{% inplace_edit "record.{object_name}.{field}" auto_height = 1, auto_width = 1 %}} + {{% inplace_edit "record.{object_name}.{field}" {params} %}} {{% endif %}} ''' template = template.format(main_part = main_part) - template = template.format(field = field_name, object_name = object_name) + template = template.format(field = field_name, object_name = object_name, params = params) super(EditableColumn, self).__init__(template, *args, **kwargs) @@ -35,7 +36,6 @@ class ColoredEditableColumn(EditableColumn): self.condition_field = condition_field def render(self, record, **kwargs): - print eval('record.%s' % self.condition_field) if self.condition_field != None and eval('record.%s' % self.condition_field): self.attrs = {'td': {'bgcolor': '#FFE4E1'}} else: diff --git a/record/settings.py b/record/settings.py index f881ad9..4ca67c3 100644 --- a/record/settings.py +++ b/record/settings.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + """ Django settings for record project. @@ -96,3 +98,9 @@ MEDIA_ROOT = 'media/' MEDIA_URL = 'http://127.0.0.1:8000/media/' THUMBNAIL_ENGINE = 'sorl.thumbnail.engines.convert_engine.Engine' + +INPLACEEDIT_EVENT = 'click' + +INPLACEEDIT_SUCCESS_TEXT = u'Сохранено' + +INPLACEEDIT_EDIT_EMPTY_VALUE = u'Редактировать'