Esempio n. 1
0
def create_entry(request, project, challenge, phase):
    """Creates a Ideation ``Submission`` with the details provided.
    Once the phase is closed we show an unavailable page
    """
    phase = get_phase_or_404(phase)
    form_class = NewEntryForm if phase.is_ideation else NewDevelopmentEntryForm
    # Phase must be open
    if not phase or not phase.is_open:
        return action_unavailable_response(request)
    extra_context = {
        'project': project,
        'challenge': challenge,
        }
    return add_submission(request, phase, form_class=form_class,
                          extra_context=extra_context)
Esempio n. 2
0
def create_entry(request, project, challenge, phase):
    """Creates a Ideation ``Submission`` with the details provided.
    Once the phase is closed we show an unavailable page
    """
    phase = get_phase_or_404(phase)
    form_class = NewEntryForm if phase.is_ideation else NewDevelopmentEntryForm
    # Phase must be open
    if not phase or not phase.is_open:
        return action_unavailable_response(request)
    extra_context = {
        'project': project,
        'challenge': challenge,
        }
    return add_submission(request, phase, form_class=form_class,
                          extra_context=extra_context)
Esempio n. 3
0
def entry_edit(request, project, challenge, pk, phase):
    """Edit ``Submission`` ideas mechanics"""
    phase = get_phase_or_404(phase)
    # Ideation phase must be open
    if not phase or not phase.is_open:
        return action_unavailable_response(request)
    form_class = EntryForm if phase.is_ideation else DevelopmentEntryForm
    extra_context = {
        'project': project,
        'challenge': challenge,
        }
    parent = get_submissionparent_or_404(challenge, slug=pk,
                                         submission__phase=phase)
    submission = parent.submission
    if not submission.editable_by(request.user):
        return HttpResponseForbidden()
    # Ideas ``Submissions`` can't be turned into Proposals
    if not submission.phase == phase:
        raise Http404
    return submission_edit(request, submission, phase, form_class=form_class,
                           extra_context=extra_context)
Esempio n. 4
0
def entry_edit(request, project, challenge, pk, phase):
    """Edit ``Submission`` ideas mechanics"""
    phase = get_phase_or_404(phase)
    # Ideation phase must be open
    if not phase or not phase.is_open:
        return action_unavailable_response(request)
    form_class = EntryForm if phase.is_ideation else DevelopmentEntryForm
    extra_context = {
        'project': project,
        'challenge': challenge,
        }
    parent = get_submissionparent_or_404(challenge, slug=pk,
                                         submission__phase=phase)
    submission = parent.submission
    if not submission.editable_by(request.user):
        return HttpResponseForbidden()
    # Ideas ``Submissions`` can't be turned into Proposals
    if not submission.phase == phase:
        raise Http404
    return submission_edit(request, submission, phase, form_class=form_class,
                           extra_context=extra_context)