Django don't show form in template --- [duplicate]
django don't show form in template
I applied everything in the Django tutorial, but foam does not appear, but I did not know the reason despite my research
add_book.html
{% extends 'base.html' %}
{% block content %}
<h1>add book </h1>
<form method="post">
{% csrf_token %}
<hr>
{{form}}
<hr>
<a href="" type="submit">submit</a>
</form>
{% endblock content %}
in forms
from django import forms
from .models import book
class book_form(forms.Form):
class meta:
model = book
fields = '__all__'
in views
from .models import *
from .forms import book_form
def addbook(request):
bookform = book_form()
context = {'form' : bookform}
return render(request, 'add_book.html', context)
in url
path('book/add', views.addbook, name="addbook"),