From 5f92e65482d400d7dabcfff3a374e4370db01a23 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Sat, 9 May 2026 20:08:33 -0400 Subject: [PATCH] MPS-20 + MPS-21: form sections + buyer entry points Shop owner-facing: - shop_settings.j2: new "Make an Offer" form section (form_section=offer-settings) with offer_enabled, auto_accept_threshold_pct, auto_decline_threshold_pct, offer_min, offer_expiration_hours, offer_max_rounds, offer_min_buyer_account_age_hours - views/shop.py: form_section=offer-settings handler with input clamping (decline forced strictly below accept; numeric inputs bounded) - product_edit.j2: pricing_mode radio (5 options: fixed, auction, auction+ buy_now, offer, offer+buy_now), allow_offers radio (inherit/yes/no) appearing only when product is in offer mode, link to live auction page when one exists - views/product.py: handles pricing_mode change; flipping into auction mode (1 or 2) creates a draft MpsAuction with start_price seeded from product.price_in_cents and default bid_increment / soft_close from lib/auction defaults Buyer-facing: - product.j2: "View live auction" link when pricing_mode is auction; "Make an offer" details/form when offers_allowed AND user authenticated AND user not in shop owners; "Log in to make an offer" CTA for anon; Add To Cart only renders when is_buy_now_allowed (modes 0, 2, 4) Tests (9 new, all passing): - TestOfferSettingsForm: enable+set thresholds (round-trip), decline clamped below accept, blank offer_min clears the floor - TestPricingModeFormSection: flip to auction creates draft auction, flip to offer leaves auction None, allow_offers override (yes/no/ inherit), invalid pricing_mode value ignored, Make Offer button renders when eligible, Make Offer hidden for shop owner Total: 913 tests pass (was 904 + 9). --- make_post_sell/templates/product.j2 | 31 ++++ make_post_sell/templates/product_edit.j2 | 68 +++++++ make_post_sell/templates/shop_settings.j2 | 71 ++++++++ make_post_sell/tests/test_functional.py | 212 ++++++++++++++++++++++ make_post_sell/views/product.py | 46 +++++ make_post_sell/views/shop.py | 59 ++++++ 6 files changed, 487 insertions(+) diff --git a/make_post_sell/templates/product.j2 b/make_post_sell/templates/product.j2 index 7d9dff1..58eba17 100644 --- a/make_post_sell/templates/product.j2 +++ b/make_post_sell/templates/product.j2 @@ -217,11 +217,42 @@ {% endif %} {% endif %} {% else %} +{% if product.is_buy_now_allowed %}
{% include "snippets/csrf.j2" %}
+{% endif %} + {% endif %} + + {# MPS-20: View Auction link when product is in auction mode. #} + {% if product.is_auction and product.auction %} +

+ + View live auction → + +

+ {% endif %} + + {# MPS-21: Make Offer button when offers are allowed for this product. #} + {% if product.offers_allowed and request.user and request.user.authenticated and request.user not in product.shop.owners %} +
+ Make an offer +
+ {% include "snippets/csrf.j2" %} + + + + +
+
+ {% elif product.offers_allowed and (not request.user or not request.user.authenticated) %} +

+ + Log in to make an offer + +

{% endif %}
diff --git a/make_post_sell/templates/product_edit.j2 b/make_post_sell/templates/product_edit.j2 index 7e71238..5752f1e 100644 --- a/make_post_sell/templates/product_edit.j2 +++ b/make_post_sell/templates/product_edit.j2 @@ -262,6 +262,74 @@ Your cover (thumbnail1) will show up on search pages.

+ + {# MPS-20 + MPS-21: pricing mode #} +
+ Pricing mode + + + + + +
+ +
+ + {# MPS-21: per-product offer override #} + {% if product.is_offer_mode %} +
+ Allow offers (override shop default) + + + +
+ +
+ {% endif %} + + {% if product.auction %} +

+ + View live auction page + + (state: {{ product.auction.state_human }}) +

+ +
+ {% endif %} {% endif %}