1👍
✅
i’m not really experienced in django too, but have been working around for 3 months now, i will advise you to make use of the django-auto-complete-light or django-ajax-selects for your frontend search in the navigation bar, and django-salmonela for your backend fields. those are helpful. and the input tag doesn’t really work with your django forms, so you’ll have to use a class in your div tag and explicitly call each form field using the {{ form.fieldName }} then make use of the widget to reference your template tags, or just use the above packages which know much better how to handle your fields.
example:
within your template:
<div class="container text-center form-horizontal topSpace">
<form method="POST" enctype="multipart/form-data" action="{% url 'create-recipe' %}">
{% csrf_token %}
{{ form.non_field_errors }}
<div class="form-group">
{{ form.name.errors }}
<label for="{{ form.name.id_for_label }}" class="col-lg-4 control-label">Name:</label>
<div class="col-lg-1">
{# <input type="text" class="form-control" id="user-name" placeholder="Enter your name">#}
{{ form.name }}
</div>
</div><!-- end form-name-->
{{ form.as_p }}
<input type="submit" value="Add Recipe">
</form>
</div>
then in your form:
class RecipeForm(autocomplete_light.ModelForm, forms.ModelForm):
class Meta:
model = Recipe
exclude = []
Source:stackexchange.com