Example #1
0
def checkout(request, passed_data=None):
    state = GitMissionPageState(request, passed_data)
    state.this_mission_page_short_name = 'Cloning'
    state.mission_step_prerequisite = 'git_config'
    data = state.as_dict_for_template_context()
    data['git_checkout_form'] = forms.CheckoutForm()
    return (request, 'missions/git/checkout.html', data)
Example #2
0
def checkout_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_checkout_form'] = forms.CheckoutForm()
    data['git_checkout_error_message'] = ''
    if request.method == 'POST':
        form = forms.CheckoutForm(request.POST)
        if form.is_valid():
            if form.cleaned_data['secret_word'].lower() == 'the brain':
                view_helpers.set_mission_completed(request.user.get_profile(),
                                                   'git_checkout')
                return HttpResponseRedirect(reverse(checkout))
            else:
                data[
                    'git_checkout_error_message'] = "The author's name is incorrect."
        data['git_checkout_form'] = form
    return checkout(request, data)