From e2c9b197b1c6fc0313c06b4f52ffc7eb61d30d0d Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Tue, 24 May 2022 19:35:18 -0600 Subject: [PATCH 1/3] Update newsletter with captcha --- .../storefront/partials/_newsletter.html | 757 ++++++++---------- 1 file changed, 341 insertions(+), 416 deletions(-) diff --git a/src/storefront/templates/storefront/partials/_newsletter.html b/src/storefront/templates/storefront/partials/_newsletter.html index bc4e462..16b770e 100644 --- a/src/storefront/templates/storefront/partials/_newsletter.html +++ b/src/storefront/templates/storefront/partials/_newsletter.html @@ -1,446 +1,371 @@ -
- - - - - - - - + +
-
+
Get 10% OFF
-
+

Subscribe to get 10% off your first order!

-
- +
+
- -
- -

-
- + +
+
+
+
- -
- -

+ +
+
+
+
+ +
+
+
-

- -

-
-
+
+
- -
+ + From 206f10cc96740b0a25f4f7f1ff7c944962a852cc Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Wed, 25 May 2022 19:03:40 -0600 Subject: [PATCH 2/3] Add post only requirement on respective views --- src/core/tests/test_models.py | 4 +++- src/storefront/views.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/tests/test_models.py b/src/core/tests/test_models.py index 009faec..59935f9 100644 --- a/src/core/tests/test_models.py +++ b/src/core/tests/test_models.py @@ -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( diff --git a/src/storefront/views.py b/src/storefront/views.py index a8e4c4f..0c553db 100644 --- a/src/storefront/views.py +++ b/src/storefront/views.py @@ -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() From 007dcb435520a0ab6f2fde9ecf6240fac82dfaae Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Wed, 25 May 2022 19:06:12 -0600 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f00fc98..c2845a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +## [1.3.12] - 2022-05-25 +### Added +- Captcha to newsletter form + +### Changed +- Post only views to accept only POST requests + ## [1.3.11] - 2022-05-21 ### Changed - File logging handler to not propagate