Commit 3ec42ef0 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

can't go to the sold page unless you have a bid

parent 5d34a599
......@@ -234,14 +234,15 @@ class SellListing(LoginRequiredMixin, UpdateView):
if not(selling_student == me):
raise Http404
flag_count = Flag.objects.filter(listing=self.get_object()).count()
if flag_count < 1:
bid_count = Bid.objects.filter(listing=self.get_object).count()
if bid_count < 1:
raise Http404
today = date.today()
form = SellListingForm(initial={'sold' : True, 'date_closed' : today})
form.fields['winning_bid'].queryset = Bid.objects.filter(listing=self.get_object())
# why does the asterisk appear, but submitting still works without it?
form.fields['winning_bid'].required = True
form.fields['sold'].widget = HiddenInput()
form.fields['date_closed'].widget = HiddenInput()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment