Advertisement
Guest User

example

a guest
Nov 21st, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. // From views.py
  2. def item_details(request, item_id):
  3. auction = SilentAuction.objects.first()
  4. context = {isAuctionActive: auction.auction_active}
  5. return render(request, 'item_details.html', context)
  6.  
  7.  
  8. // From item_details.html
  9. <div id="form">
  10. <h3>
  11. Make a Bid
  12. </h3>
  13. {% if error_message %}
  14. <p><strong>{{ error_message }}</strong></p>
  15. {% endif %}
  16. {% if !isAuctionActive %}
  17. <p> Auction aint live yet bruh </p>
  18. {% endif %}
  19. <form action="{% url 'auction:add_bid' blog.pk %}" method="post">
  20. {% csrf_token %}
  21. <label>Name:
  22. <input type="number" name="bid" id="bid"><br>
  23. </label><br>
  24. // Disable the button when the auction is not active so people can't make bids
  25. <input type="submit" value="Submit" style="margin-top: 20px;" disabled="{% !isAuctionActive %}">
  26. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement