manual form render order
This commit is contained in:
@ -35,11 +35,9 @@ class ExternalRecipeForm(forms.ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class InternalRecipeForm(forms.ModelForm):
|
class InternalRecipeForm(forms.ModelForm):
|
||||||
table_pos = forms.CharField(show_hidden_initial=True, required=False, widget=forms.HiddenInput())
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Recipe
|
model = Recipe
|
||||||
fields = ('name', 'table_pos', 'instructions', 'time', 'keywords')
|
fields = ('name', 'instructions', 'time', 'keywords')
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
'name': _('Name'),
|
'name': _('Name'),
|
||||||
|
@ -20,12 +20,18 @@
|
|||||||
<form action="." method="post">
|
<form action="." method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
{{ form|crispy }}
|
{% for field in form %}
|
||||||
<div id="ingredients-table"></div>
|
<div class="fieldWrapper">
|
||||||
<br>
|
{{ field|as_crispy_field }}
|
||||||
<div class="table-controls">
|
</div>
|
||||||
<button class="btn" id="new_empty" type="button"><i class="fas fa-plus-circle"></i></button>
|
{% if field.name == 'name' %}
|
||||||
</div>
|
<div id="ingredients-table"></div>
|
||||||
|
<br>
|
||||||
|
<div class="table-controls">
|
||||||
|
<button class="btn" id="new_empty" type="button"><i class="fas fa-plus-circle"></i></button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
<input type="hidden" id="ingredients_data_input" name="ingredients">
|
<input type="hidden" id="ingredients_data_input" name="ingredients">
|
||||||
<hr>
|
<hr>
|
||||||
@ -45,9 +51,9 @@
|
|||||||
|
|
||||||
var ingredients = {{ ingredients|safe }}
|
var ingredients = {{ ingredients|safe }}
|
||||||
|
|
||||||
ingredients.forEach(function (cur, i) {
|
ingredients.forEach(function (cur, i) {
|
||||||
cur.delete = false
|
cur.delete = false
|
||||||
})
|
})
|
||||||
|
|
||||||
var data = ingredients
|
var data = ingredients
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user