def get_context_data(self, **kwargs): context = super(HomeView, self).get_context_data(**kwargs) try: context['auctions'] = Auction.fetchActiveAuctions() return context except Auction.DoesNotExist: raise Http404
def list_auction(request): context_instance = RequestContext(request) try: queryset = Auction.fetchActiveAuctions() context = {'auctions': queryset, } return render_to_response("index.html", context, context_instance) except Product.DoesNotExist: raise Http404
def list_auction(request): context_instance = RequestContext(request) try: queryset = Auction.fetchActiveAuctions() context = { 'auctions': queryset, } return render_to_response("index.html", context, context_instance) except Product.DoesNotExist: raise Http404
def search_auction(request): context_instance = RequestContext(request) success = False if request.method == 'POST' and request.POST.get('search'): keytitle = request.POST.get('keytitle') if len(keytitle): aucfound = Auction.fetchActiveAuctions().filter(title__icontains=keytitle) if aucfound: success = True messages.success(request, 'The following auction/s found.') return render_to_response('search.html', {'auc': aucfound, 'display': success}, context_instance) else: messages.info(request, 'No search result found.') return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/')) else: messages.error(request, 'No auction title provided on the search field!') return render_to_response('search.html', {'display': success}, context_instance)
def search_auction(request): context_instance = RequestContext(request) success = False if request.method == 'POST' and request.POST.get('search'): keytitle = request.POST.get('keytitle') if len(keytitle): aucfound = Auction.fetchActiveAuctions().filter( title__icontains=keytitle) if aucfound: success = True messages.success(request, 'The following auction/s found.') return render_to_response('search.html', { 'auc': aucfound, 'display': success }, context_instance) else: messages.info(request, 'No search result found.') return HttpResponseRedirect( request.META.get('HTTP_REFERER', '/')) else: messages.error(request, 'No auction title provided on the search field!') return render_to_response('search.html', {'display': success}, context_instance)