diff --git a/auctions/forms.py b/auctions/forms.py
index 04db5d1..5dd9cc1 100755
--- a/auctions/forms.py
+++ b/auctions/forms.py
@@ -1563,6 +1563,7 @@ class Meta:
"minimum_bid",
"winning_bid_percent_to_club_for_club_members",
"lot_entry_fee_for_club_members",
+ "force_donation_threshold",
"require_phone_number",
"reserve_price",
"buy_now",
@@ -1685,6 +1686,12 @@ def __init__(self, *args, **kwargs):
"%",
wrapper_class="col-lg-3",
),
+ PrependedAppendedText(
+ "force_donation_threshold",
+ "$",
+ ".00",
+ wrapper_class="col-lg-3",
+ ),
css_class="row",
),
HTML("
Lot fee discounts
"),
diff --git a/auctions/migrations/0164_auction_force_donation_threshold.py b/auctions/migrations/0164_auction_force_donation_threshold.py
new file mode 100644
index 0000000..5ff03af
--- /dev/null
+++ b/auctions/migrations/0164_auction_force_donation_threshold.py
@@ -0,0 +1,25 @@
+# Generated by Django 5.1.1 on 2024-11-14 18:05
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("auctions", "0163_alter_auction_summernote_description_and_more"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="auction",
+ name="force_donation_threshold",
+ field=models.PositiveIntegerField(
+ blank=True,
+ default=None,
+ help_text="Most auctions should leave this blank. Force lots to be a donation if they sell for this amount or less.",
+ null=True,
+ validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(10)],
+ verbose_name="Donation threshold",
+ ),
+ ),
+ ]
diff --git a/auctions/models.py b/auctions/models.py
index c21d4c5..cd6232c 100755
--- a/auctions/models.py
+++ b/auctions/models.py
@@ -536,6 +536,16 @@ class Auction(models.Model):
pre_register_lot_entry_fee_discount.help_text = (
"Decrease the lot entry fee by this amount if users add lots through this website"
)
+ force_donation_threshold = models.PositiveIntegerField(
+ default=None,
+ blank=True,
+ null=True,
+ validators=[MinValueValidator(0), MaxValueValidator(10)],
+ verbose_name="Donation threshold",
+ )
+ force_donation_threshold.help_text = (
+ "Most auctions should leave this blank. Force lots to be a donation if they sell for this amount or less."
+ )
date_posted = models.DateTimeField(auto_now_add=True)
date_start = models.DateTimeField("Auction start date")
date_start.help_text = "Bidding starts on this date"
@@ -2186,6 +2196,13 @@ def save(self, *args, **kwargs):
# when an auction is set to be buy now only
# if self.auction and self.auction.online_bidding == "buy_now_only":
# self.reserve_price = self.buy_now_price
+ if (
+ self.auction
+ and self.auction.force_donation_threshold
+ and self.winning_price
+ and self.winning_price <= self.auction.force_donation_threshold
+ ):
+ self.donation = True
super().save(*args, **kwargs)
# chat history subscription for the owner
diff --git a/auctions/templates/auction.html b/auctions/templates/auction.html
index a813209..bd922ff 100755
--- a/auctions/templates/auction.html
+++ b/auctions/templates/auction.html
@@ -181,6 +181,7 @@ The following rules will be automatically enforced by this site:
{% if auction.lot_entry_fee %} You will be charged a flat rate of ${{ auction.lot_entry_fee }} per lot you sell {% endif %}
{% endif %}
{% if auction.unsold_lot_fee %}If your lot does not sell, you will be charged ${{ auction.unsold_lot_fee }}{% endif %}
+ {% if auction.force_donation_threshold %}If your lot sells for ${{auction.force_donation_threshold}} or less, it will be considered a donation to the club{% endif %}
{% if auction.minimum_bid > 2 %} There will be a minimum bid of ${{auction.minimum_bid}} on all lots{% if auction.reserve_price != "disable" %}, and sellers can set their own minimum bids{% endif %} {% endif %}
{% if auction.buy_now != 'disable' %} Sellers can set a buy now price on their lots, which will allow a lot to be sold without bidding {% endif %}
diff --git a/auctions/views.py b/auctions/views.py
index 99bbb36..8321287 100755
--- a/auctions/views.py
+++ b/auctions/views.py
@@ -3912,6 +3912,7 @@ def form_valid(self, form, **kwargs):
"auto_add_images",
"message_users_when_lots_sell",
"label_print_fields",
+ "force_donation_threshold",
]
for field in fields_to_clone:
setattr(auction, field, getattr(original_auction, field))