From f8d0724daf5e9412262210e37a51b531ecb67f6c Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Tue, 19 Nov 2019 21:02:33 +0100 Subject: [PATCH] manual form render order --- cookbook/forms.py | 4 +--- .../templates/forms/edit_internal_recipe.html | 24 ++++++++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/cookbook/forms.py b/cookbook/forms.py index 1990047ca..b5dca7256 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -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'), diff --git a/cookbook/templates/forms/edit_internal_recipe.html b/cookbook/templates/forms/edit_internal_recipe.html index 3f747f0ce..18b1cb63a 100644 --- a/cookbook/templates/forms/edit_internal_recipe.html +++ b/cookbook/templates/forms/edit_internal_recipe.html @@ -20,12 +20,18 @@
{% csrf_token %} - {{ form|crispy }} -
-
-
- -
+ {% for field in form %} +
+ {{ field|as_crispy_field }} +
+ {% if field.name == 'name' %} +
+
+
+ +
+ {% endif %} + {% endfor %}
@@ -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