Реализовано добавление статей по умполчанию при создании заказа. Форма создания заказа перенесена в таблицу
This commit is contained in:
41
templates/asuzr/table_with_form.html
Normal file
41
templates/asuzr/table_with_form.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{% extends "asuzr/totals_table.html" %}
|
||||
{% load django_tables2 %}
|
||||
{% load i18n %}
|
||||
{% block table.tbody %}
|
||||
<tbody>
|
||||
{% for row in table.page.object_list|default:table.rows %} {# support pagination #}
|
||||
{% block table.tbody.row %}
|
||||
<tr class="{{ forloop.counter|divisibleby:2|yesno:"even,odd" }}"> {# avoid cycle for Django 1.2-1.6 compatibility #}
|
||||
{% for column, cell in row.items %}
|
||||
<td {{ column.attrs.td.as_html }}>{% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}{{ cell|localize }}{% else %}{{ cell|unlocalize }}{% endif %}{% endif %}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endblock table.tbody.row %}
|
||||
{% empty %}
|
||||
{% if table.empty_text %}
|
||||
{% block table.tbody.empty_text %}
|
||||
<tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr>
|
||||
{% endblock table.tbody.empty_text %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if model_form %}
|
||||
<form action="{% url 'add-order' %}" method="POST" >
|
||||
{% csrf_token %}
|
||||
<tr>
|
||||
<td>{{model_form.product}}</td>
|
||||
<td>{{model_form.price}}</td>
|
||||
<td>{{model_form.paid}}</td>
|
||||
<td>{{model_form.address}}</td>
|
||||
<td></td>
|
||||
<td>{{model_form.deadline}}</td>
|
||||
<td>{{model_form.delivery}}</td>
|
||||
<td>{{model_form.lifting}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
|
||||
<td><input type="submit" text="Добавить заказ"></td>
|
||||
</tr>
|
||||
</form>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
{% endblock table.tbody %}
|
||||
Reference in New Issue
Block a user