Skip to content

Commit 2b1c8f0

Browse files
authored
Merge pull request #321 from iragm/march-2025-fixes
Restore CSV import and small tweaks
2 parents ffe7c9f + bc8f009 commit 2b1c8f0

File tree

6 files changed

+372
-323
lines changed

6 files changed

+372
-323
lines changed

auctions/forms.py

+19-23
Original file line numberDiff line numberDiff line change
@@ -2102,29 +2102,25 @@ def __init__(self, *args, **kwargs):
21022102
# self.fields['species_search'].initial = self.instance.species.common_name.split(",")[0]
21032103
else:
21042104
if self.cloned_from:
2105-
try:
2106-
cloneLot = Lot.objects.get(pk=self.cloned_from, is_deleted=False)
2107-
if (cloneLot.user.pk == self.user.pk) or self.user.is_superuser:
2108-
# you can only clone your lots
2109-
cloneFields = [
2110-
"lot_name",
2111-
"quantity",
2112-
"species_category",
2113-
# "description",
2114-
"summernote_description",
2115-
"i_bred_this_fish",
2116-
"reserve_price",
2117-
"buy_now_price",
2118-
"reference_link",
2119-
"donation",
2120-
"custom_checkbox",
2121-
"custom_field_1",
2122-
]
2123-
for field in cloneFields:
2124-
self.fields[field].initial = getattr(cloneLot, field)
2125-
self.fields["cloned_from"].initial = int(self.cloned_from)
2126-
except:
2127-
pass
2105+
clone_from_lot = Lot.objects.filter(pk=self.cloned_from, is_deleted=False).first()
2106+
if clone_from_lot and ((clone_from_lot.user.pk == self.user.pk) or self.user.is_superuser):
2107+
# you can only clone your lots
2108+
cloneFields = [
2109+
"lot_name",
2110+
"quantity",
2111+
"species_category",
2112+
"summernote_description",
2113+
"i_bred_this_fish",
2114+
"reserve_price",
2115+
"buy_now_price",
2116+
"reference_link",
2117+
"donation",
2118+
"custom_checkbox",
2119+
"custom_field_1",
2120+
]
2121+
for field in cloneFields:
2122+
self.fields[field].initial = getattr(clone_from_lot, field)
2123+
self.fields["cloned_from"].initial = int(self.cloned_from)
21282124
# default to making new lots part of a club auction
21292125
self.fields["part_of_auction"].initial = "True"
21302126
self.fields["run_duration"].initial = 10

auctions/templates/auction_ribbon.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h3>{{auction}}</h3>
2727
<a class="nav-link {% if active_tab == 'main'%}active{% endif %}" href="/auctions/{{auction.slug}}/"><i class="bi bi-house-fill"></i><span class='d-none d-md-inline'> Main</span></a>
2828
</li>
2929
<li class="nav-item">
30-
<a class="nav-link {% if active_tab == 'users'%}active{% endif %}" href="/auctions/{{auction.slug}}/users"><i class="bi bi-people-fill"></i><span class='d-none d-md-inline'> Users</span></a>
30+
<a class="nav-link {% if active_tab == 'users'%}active{% endif %}" href='{% url "auction_tos_list" slug=auction.slug %}'><i class="bi bi-people-fill"></i><span class='d-none d-md-inline'> Users</span></a>
3131
</li>
3232
<li class="nav-item">
3333
<a class="nav-link {% if active_tab == 'lots'%}active{% endif %}" href="/auctions/{{auction.slug}}/lots"><i class="bi bi-calendar"></i><span class='d-none d-md-inline'> Lots</span></a>

auctions/templates/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
<div class="dropdown-menu">
303303
<a class="dropdown-item" href="{% url 'admin_dashboard' %}">User stats</a>
304304
<a class="dropdown-item" href="{% url 'admin_user_map' %}?view=recent&filter=24">User map</a>
305-
<a class="dropdown-item" href="{% url 'admin_traffic' %}">Traffic</a>
305+
<a class="dropdown-item" href="{% url 'admin_traffic' %}?days=30">Traffic</a>
306306
<a class="dropdown-item" href="{% url 'admin_referrers' %}?days=30">Referrers</a>
307307
<a class="dropdown-item" href="/admin/auth/user/?o=-5">Admin site</a>
308308
<a class="dropdown-item" href="{% url 'admin_error' %}">Test error messages</a>

auctions/templates/lot_form.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
function setAuction(setting) {
1515
if (setting) {
16-
$('#div_id_auction').closest('.col-md-3').show();
16+
$('#div_id_auction').closest('.col-md-8').show();
1717
$('#div_id_donation').closest('.col-md-3').show();
1818
$('#div_id_relist_if_not_sold').closest('.mb-3').hide();
1919
$('#div_id_relist_if_sold').closest('.mb-3').hide();
@@ -25,7 +25,7 @@
2525
setAuctionRequiredFields($('#id_auction').val())
2626
} else {
2727
// fields for non-auction lots
28-
$('#div_id_auction').closest('.col-md-3').hide();
28+
$('#div_id_auction').closest('.col-md-8').hide();
2929
$('#div_id_donation').closest('.col-md-3').hide();
3030
//$('#div_id_promoted').closest('.col-md-3').show();
3131
$('#div_id_relist_if_not_sold').closest('.mb-3').show();

0 commit comments

Comments
 (0)