I created simple form in django. I tried do it in many different ways check all posibilities but still my HTML code doesn't see this form. Code looks like :
forms.py
from django import forms
class TimeTable(forms.Form):
title = forms.CharField(max_length=100, required=True)
time_start = forms.DateTimeField()
time_end = forms.DateTimeField()
views.py
from home.forms import TimeTable
from django.shortcuts import render
def schedule(request):
if request.method == 'POST':
form = TimeTable(request.POST)
if form.is_valid():
pass
else:
form = TimeTable()
return render(request, "registration/schedule.html", {'schedule_form': form})
urls.py
from django.contrib import admin
from django.urls import path, include
from django.views.generic.base import TemplateView
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls')),
path('', TemplateView.as_view(template_name='home.html'), name='home'),
path('accounts/login/', TemplateView.as_view(template_name='registration/login.html'), name='login'),
path('schedule/', TemplateView.as_view(template_name='registration/schedule.html'), name='schedule'),
]
schedule.html
{% block calendar %}
<div class="calendar_create">
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
{% endblock %}
</div>
HTML only see this <button> mark rest is missing. I tried do it with many tutorials, django documentation and all this stuff doesn't work for me. What I'm doing wrong ?