Есть форма подписки, она принимает данные, но форма не отправляется. Плюс в консоли появляется ошибка
Method Not Allowed (GET): /subscribe-form/
<form action="{% url 'subscribe_form' %}" class="row g-3">
{% csrf_token %}
<div class="col-auto">
<input type="text" class="form-control" name="name" placeholder="Enter your name">
</div>
<div class="col-auto">
<input type="email" class="form-control" name="email" placeholder="Enter your email">
</div>
<div class="col-auto">
<button class="btn btn-primary" type="submit">
<span class="fa fa-paper-plane"></span>
</button>
</div>
</form>
model
class EmailSubscribers(models.Model):
name = models.CharField(max_length=50)
email = models.EmailField(max_length=50)
subscribe_date = models.DateTimeField(auto_now_add=True)
class Meta:
verbose_name = 'Subscriber'
verbose_name_plural = 'Subscribers'
view
class Subscribe(View):
def post(self, request):
form = SubscribeForm(request.POST)
if form.is_valid():
form.save()
else:
print(form.errors)
return redirect('home')
form
from django import forms
from .models import *
class SubscribeForm(forms.ModelForm):
class Meta:
model = EmailSubscribers
fields = ['name', 'email']
url
from django.urls import path
from .views import *
urlpatterns = [
path('subscribe-form/', Subscribe.as_view(), name='subscribe_form'),
path('home/', HomePage.as_view(), name="home"),
path('shop/', ShopPage.as_view(), name='shop'),
path('about/', AboutPage.as_view(), name='about'),
path('services/', ServicePage.as_view(), name='services'),
path('blog/', BlogPage.as_view(), name='blog'),
path('contact/', ContactPage.as_view(), name='contact')
]