Example #1
0
def newrack_form(request):
    if request.method == 'POST':
        _maybe_geocode(request)
        form = RackForm(request.POST,request.FILES)
        if form.is_valid():
            new_rack = form.save()
            # create steps status for new rack suggestion
            size_up = Steps(step_rack=new_rack,name="size-up",status="todo")
            size_up.save()
            photo_status = Steps(step_rack=new_rack,name="photo",status='todo')
            photo_status.save()
            statement = Steps(step_rack=new_rack,name="statement",status='todo')
            statement.save()
            message = '''
            Thank you for your suggestion! Racks can take six months
            or more for the DOT to install, but we\'ll be in touch
            about its progress. <a href="/rack/new/">Add another
            rack</a> or continue to see other suggestions.
            '''
            flash(message, request)
            return HttpResponseRedirect('/verify/')
        else:
            flash('Please correct the following errors.', request)
    else:
        form = RackForm()
    return render_to_response('newrack.html', { 
            'form': form,
           },
           context_instance=RequestContext(request, processors=[user_context])) 
Example #2
0
def change_status(request,rack_id): 
    id = request.POST['id']
    step = Steps.objects.get(id=id)
    if step.status == 'finished': 
        new_step = Steps(id=id,step_rack=step.step_rack,name=step.name,status='todo')
        new_step.save()
    else: 
        new_step = Steps(id=id,step_rack=step.step_rack,name=step.name,status='finished')
        new_step.save()
    return HttpResponse(step)