def microslot_proposal( request, template_name="microslot_proposal.html"): success_message = None if request.method == 'POST': microslot_form = MicroslotProposalForm(request.POST) if microslot_form.is_valid(): microslot_proposal = microslot_form.save() success_message = { 'heading':'Thank you for your proposal', 'body':"Good people like you help keep Geek Nights going. We'll be in touch soon!" } else: microslot_form = MicroslotProposalForm() return render_with_context(request, template_name, {'microslot_form':microslot_form, 'success_message':success_message })
selected_night = cached_night_data[0] previous_nights = cached_night_data[1] else: try: selected_night = all_nights[0] previous_nights = all_nights.filter(date_and_time__lt=datetime.now()) #future_nights = all_nights.filter(date_and_time__gt=datetime.now()) # we don't need this cache.set(cache_key_name, (selected_night, previous_nights)) #uses default cache expiry time except IndexError, e: pass return render_with_context(request, template_name, { 'all_nights':all_nights, 'previous_nights':previous_nights, 'future_nights':future_nights, 'selected_night':selected_night }) def microslot_proposal( request, template_name="microslot_proposal.html"): success_message = None if request.method == 'POST': microslot_form = MicroslotProposalForm(request.POST) if microslot_form.is_valid(): microslot_proposal = microslot_form.save() success_message = { 'heading':'Thank you for your proposal',