Ejemplo n.º 1
0
def rebase(request, passed_data=None):
    state = GitMissionPageState(request, passed_data)
    state.this_mission_page_short_name = 'Rebase'
    state.mission_step_prerequisite = 'git_diff'
    data = state.as_dict_for_template_context()
    data['git_rebase_form'] = forms.RebaseForm()
    return (request, 'missions/git/rebase.html', data)
Ejemplo n.º 2
0
def rebase_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_rebase_form'] = forms.RebaseForm()
    data['git_rebase_error_message'] = ''
    if request.method == 'POST':
        form = forms.RebaseForm(request.POST)
        if form.is_valid():
            lower_secret = form.cleaned_data['secret_word'].lower()
            if lower_secret == 'pinky' or lower_secret == 'pinky.':
                view_helpers.set_mission_completed(request.user.get_profile(),
                                                   'git_rebase')
                return HttpResponseRedirect(reverse(rebase))
            else:
                data['git_rebase_error_message'] = "The password is incorrect."
        data['git_rebase_form'] = form
    return rebase(request, data)