table_with_form.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {% extends "asuzr/totals_table.html" %}
  2. {% load django_tables2 %}
  3. {% load i18n %}
  4. {% block table.tbody %}
  5. <tbody>
  6. {% for row in table.page.object_list|default:table.rows %} {# support pagination #}
  7. {% block table.tbody.row %}
  8. <tr class="{{ forloop.counter|divisibleby:2|yesno:"even,odd" }}"> {# avoid cycle for Django 1.2-1.6 compatibility #}
  9. {% for column, cell in row.items %}
  10. <td {{ column.attrs.td.as_html }}>{% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}{{ cell|localize }}{% else %}{{ cell|unlocalize }}{% endif %}{% endif %}</td>
  11. {% endfor %}
  12. </tr>
  13. {% endblock table.tbody.row %}
  14. {% empty %}
  15. {% if table.empty_text %}
  16. {% block table.tbody.empty_text %}
  17. <tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr>
  18. {% endblock table.tbody.empty_text %}
  19. {% endif %}
  20. {% endfor %}
  21. {% if model_form %}
  22. <form action="{% url 'add-order' %}" method="POST" >
  23. {% csrf_token %}
  24. <tr>
  25. <td>{{model_form.product}}</td>
  26. <td>{{model_form.price}}</td>
  27. <td>{{model_form.paid}}</td>
  28. <td>{{model_form.address}}</td>
  29. <td></td>
  30. <td>{{model_form.deadline}}</td>
  31. <td>{{model_form.delivery}}</td>
  32. <td>{{model_form.lifting}}</td>
  33. </tr>
  34. <tr>
  35. <td></td><td></td><td></td><td></td><td></td><td></td><td></td>
  36. <td><input type="submit" text="Добавить заказ"></td>
  37. </tr>
  38. </form>
  39. {% endif %}
  40. </tbody>
  41. {% endblock table.tbody %}