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