def handle(self, *args, **options): current_time = timezone.now() ended_auctions = AuctionEvent.objects.filter( end_time__lt=current_time, item__status=AUCTION_ITEM_STATUS_RUNNING ) for auction_event in ended_auctions: process_ended_auction(auction_event)
def view_ended_auction_event(request, auction_event_id=None): try: auction_event = AuctionEvent.objects.get(pk=auction_event_id) except AuctionEvent.DoesNotExist: raise Http404 if not auction_event.is_running(): process_ended_auction(auction_event) return render_to_response('view_ended_auction.html', { 'auction_event': auction_event }, context_instance=RequestContext(request))