Forráskód Böngészése

Формы

Сделал объединение ячеек
Сделал выравнивание по правой стороне
Переименовал кнопки
Denis V. Dedkov 10 éve
szülő
commit
772670ebf9
3 módosított fájl, 16 hozzáadás és 11 törlés
  1. 3 1
      asuzr/forms.py
  2. 3 0
      templates/asuzr/base.html
  3. 10 10
      templates/asuzr/table_with_form.html

+ 3 - 1
asuzr/forms.py

@@ -47,7 +47,8 @@ class OrderForm(ModelForm):
   class Meta:
     model = Order
     fields = ['product', 'price', 'paid', 'address', 'designer', 'deadline', 'delivery', 'lifting']
-    
+
+  submit_text = "Добавить заказ"
   product = forms.ModelChoiceField(
 				    required=False,
 				    queryset = Product.objects.all(),
@@ -60,6 +61,7 @@ class ProdTableForm(ModelForm):
     model = OrderCosts
     fields = ['cost_item', 'value']
     
+  submit_text = "Добавить"
   cost_item = forms.ModelChoiceField(
 				    required=False,
 				    queryset = CostItem.objects.all(),

+ 3 - 0
templates/asuzr/base.html

@@ -57,6 +57,9 @@
       margin-left: 12px;
       margin-top: 6px;
     }
+    table.paleblue td.align-right {
+      text-align: right;
+    }
     body {
       background: #F5F5F5
     }

+ 10 - 10
templates/asuzr/table_with_form.html

@@ -20,21 +20,21 @@
         {% endif %}
         {% endfor %}
         {% if add_form %}
-        {% if params %}
-        <form action="{% url form_action params %}" method="POST" >
-        {% else %}
-        <form action="{% url form_action %}" method="POST" >
-        {% endif %}
+          {% if params %}
+            <form action="{% url form_action params %}" method="POST" >
+          {% else %}
+            <form action="{% url form_action %}" method="POST" >
+          {% endif %}
 	  {% csrf_token %}
 	  <tr>
-	  {% for field in add_form %}
-	    <td>{{field}}</td>
-	  {% endfor %}  
+	    {% for field in add_form %}
+	      <td>{{field}}</td>
+	    {% endfor %}  
 	  </tr>
 	  <tr>
-	    <td><input type="submit" text="Добавить заказ"></td>
+		  <td class="align-right" colspan="{{ add_form.fields|length }}"><input type="submit" value="{{ add_form.submit_text }}"></td>
 	  </tr>
 	</form>
         {% endif %}
     </tbody>
-{% endblock table.tbody %}
+{% endblock table.tbody %}