промежуточные результаты (добавление строк в таблице Производственный план)

This commit is contained in:
Anastasia
2015-09-07 16:03:32 +05:00
parent 463faa3cee
commit 3e43d35fc9
6 changed files with 27 additions and 3 deletions

View File

@@ -68,3 +68,11 @@ class ProdTableForm(ModelForm):
queryset = CostItem.objects.all(),
widget=RelatedFieldWidgetCanAdd(CostItem)
)
class ProdPlanForm(ModelForm):
class Meta:
model = ProdPlan
fields = ['start_date', 'order', 'executor','action']
submit_text = "Добавить"
start_date = forms.DateField(widget = AdminDateWidget(format = '%d.%m.%Y'))

View File

@@ -213,6 +213,7 @@ class ProdPlanTable(tables.Table):
class Meta:
attrs = {'class': 'paleblue'}
template = 'asuzr/table_with_form.html'
class ProductionTable(tables.Table):
cost_item = tables.Column(verbose_name = 'Комплектующие')

View File

@@ -302,9 +302,13 @@ def prod_plan_view(request):
table = ProdPlanTable(week_days.values())
title = u'Производственный план на %s - %s' % (sdate.strftime('%d.%m.%Y'), edate.strftime('%d.%m.%Y'))
form = DateForm({'date':curr_date})
date_form = DateForm({'date':curr_date})
add_form = ProdPlanForm()
RequestConfig(request).configure(table)
return render(request, 'asuzr/table.html', {'table': table, 'title': title, 'dateform': form})
return render(request, 'asuzr/table.html', {'table': table, 'title': title, 'dateform': date_form, 'add_form': add_form, 'form_action' : 'add-plan-item'})
def prod_plan_add_item(request):
return redirect(prod_plan_view)
@login_required
def log_view(request):