auction.forms: 17 total statements, 0.0% covered

Generated: Mon 2013-04-29 18:13 CST

Source file: /home/slam/workspace/django-auction/auction/forms.py

Stats: 0 executed, 13 missed, 4 excluded, 9 ignored

  1. from django import forms
  2. import auction.models
  3. from auction.utils.generic import get_or_create_bidbasket
  4. from auction.models import Lot
  5. class BidForm(forms.Form):
  6. amount = forms.DecimalField()
  7. lot_id = forms.IntegerField()
  8. def save_bid(self, request):
  9. lot_id = self.data.get('lot_id')
  10. amount = self.data.get('amount')
  11. lot = self.get_lot(lot_id)
  12. bidbasket = get_or_create_bidbasket(request)
  13. if bidbasket:
  14. return bidbasket.add_bid(lot, amount)
  15. return False
  16. def get_lot(self, lot_id):
  17. """
  18. For simplified extending.
  19. """
  20. #return auction.models.Lot.objects.get(pk=lot_id)
  21. return Lot.objects.filter(is_biddable=True).get(pk=lot_id)