From 6f054bef1ffccddb971297b58e0e3ca5fe47866a Mon Sep 17 00:00:00 2001 From: "Denis V. Dedkov" Date: Tue, 16 Jun 2015 23:08:22 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B0=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=BE=D0=B2=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=B5=D0=BD=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавил таблицу заказов на день --- asuzr/tables.py | 31 ++++++++++++++++++++++++------- asuzr/views.py | 7 ++++++- templates/asuzr/base.html | 1 + 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/asuzr/tables.py b/asuzr/tables.py index e65d13b..f14b83d 100644 --- a/asuzr/tables.py +++ b/asuzr/tables.py @@ -43,7 +43,7 @@ class ThumbnailColumn(tables.TemplateColumn): class OrdersTable(tables.Table): date = tables.DateColumn('d/m/Y', verbose_name = 'Дата') - deadline = tables.DateColumn('d/m/Y/', verbose_name = 'Срок сдачи') + deadline = tables.DateColumn('d/m/Y', verbose_name = 'Срок сдачи') product = tables.Column(verbose_name = 'Наименование') delivery = EditableColumn('delivery', verbose_name = 'Доставка') lifting = EditableColumn('lifting', verbose_name = 'Подъем') @@ -55,12 +55,7 @@ class OrdersTable(tables.Table): sketch = tables.LinkColumn('asuzr.views.sketches', verbose_name = 'Эскизы', args=[tables.utils.A('pk')]) executor = EditableColumn('executor', verbose_name = 'Исполнитель') is_done = EditableColumn('is_done', verbose_name = 'Сдан') - id = tables.Column(visible = False) - designer = tables.Column(visible = False) - calls = tables.Column(visible = False) - contact = tables.Column(visible = False) - phone_num = tables.Column(visible = False) - cancelled = tables.Column(visible = False) + designer = tables.Column(visible = False) # Почему-то дизайнер в exclude вызывает ошибку, м.б. из-за FK. Разобраться def render_price(self, value): return '%0.1f' % value @@ -84,6 +79,7 @@ class OrdersTable(tables.Table): 'sketch', 'executor', 'is_done',) + exclude = ('id', 'calls', 'contact', 'phone_num', 'cancelled',) class ArchiveOrdersTable(OrdersTable): calls = EditableColumn('calls', verbose_name = 'Обзвон') @@ -142,3 +138,24 @@ class VisitTable(tables.Table): attrs = {'class': 'paleblue'} orderable = False template = 'asuzr/weekend_table.html' + +class DayOrdersTable(OrdersTable): + designer = tables.Column(verbose_name = 'Дизайнер') + class Meta: + attrs = {'class': 'paleblue'} + exclude = ('date', + 'delivery', + 'lifting', + 'paid', + 'ostatok', + 'approved', + 'sketch', + 'executor', + 'is_done', + ) + sequence = ('product', + 'price', + 'address', + 'designer', + 'deadline', + ) diff --git a/asuzr/views.py b/asuzr/views.py index 5405122..07ad73b 100644 --- a/asuzr/views.py +++ b/asuzr/views.py @@ -87,10 +87,15 @@ def visit_view(request): curr_date = datetime.strptime(request.GET.get('date', date.today().strftime('%d.%m.%Y')), '%d.%m.%Y') attendance_table = get_attendance_table(curr_date.year, curr_date.month, 'attendance-') RequestConfig(request, paginate={'per_page': 32}).configure(attendance_table) + + orders_table = DayOrdersTable(Order.objects.filter(date = curr_date)) + orders_table.verbose_name = 'Заказы на %s г' % curr_date.strftime('%d %B %Y') + RequestConfig(request).configure(orders_table) + title = 'Таблица посещаемости на %s г.' % curr_date.strftime('%B %Y') return render(request, 'asuzr/table3.html', { 'table1': attendance_table, - 'table2': attendance_table, + 'table2': orders_table, 'table3': attendance_table, 'title': title}) diff --git a/templates/asuzr/base.html b/templates/asuzr/base.html index 69d7f6a..2914f10 100644 --- a/templates/asuzr/base.html +++ b/templates/asuzr/base.html @@ -31,6 +31,7 @@ } .inline { display: inline-block; + vertical-align: top; }