Add post only requirement on respective views
This commit is contained in:
parent
e2c9b197b1
commit
206f10cc96
@ -2,7 +2,7 @@ from decimal import Decimal
|
||||
from django.test import TestCase
|
||||
|
||||
from measurement.measures import Weight
|
||||
|
||||
from accounts.models import User
|
||||
from core.models import (
|
||||
Product,
|
||||
ProductPhoto,
|
||||
@ -16,6 +16,8 @@ from core.models import (
|
||||
|
||||
|
||||
class ProductModelTest(TestCase):
|
||||
fixtures = ['accounts.json']
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
Product.objects.create(
|
||||
|
||||
@ -65,6 +65,7 @@ class CartView(TemplateView):
|
||||
class CartAddProductView(SingleObjectMixin, FormView):
|
||||
model = Product
|
||||
form_class = AddToCartForm
|
||||
http_method_names = ['post']
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('storefront:cart-detail')
|
||||
@ -90,6 +91,7 @@ class CartAddProductView(SingleObjectMixin, FormView):
|
||||
class CartUpdateProductView(SingleObjectMixin, FormView):
|
||||
model = Product
|
||||
form_class = UpdateCartItemForm
|
||||
http_method_names = ['post']
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('storefront:cart-detail')
|
||||
@ -121,9 +123,9 @@ def cart_remove_product_view(request, pk, grind):
|
||||
|
||||
|
||||
class CouponApplyView(FormView):
|
||||
template_name = 'contact.html'
|
||||
form_class = CouponApplyForm
|
||||
success_url = reverse_lazy('storefront:cart-detail')
|
||||
http_method_names = ['post']
|
||||
|
||||
def form_valid(self, form):
|
||||
today = timezone.localtime(timezone.now()).date()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user