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