示例#1
0
def start(request, type=None):
    competing_interests = setting_handler.get_setting(
        'general', 'submission_competing_interests', request.journal)
    form = forms.ArticleStart(ci=competing_interests)

    if not request.user.is_author(request):
        request.user.add_account_role('author', request.journal)

    if request.POST:
        form = forms.ArticleStart(request.POST, ci=competing_interests)

        if form.is_valid():
            new_article = form.save(commit=False)
            new_article.owner = request.user
            new_article.journal = request.journal
            new_article.current_step = 1
            new_article.article_agreement = logic.get_agreement_text(
                request.journal)
            new_article.save()

            if type == 'preprint':
                preprint_models.Preprint.objects.create(article=new_article)

            if setting_handler.get_setting('general',
                                           'user_automatically_author',
                                           request.journal).processed_value:
                logic.add_self_as_author(request.user, new_article)

            return redirect(
                reverse('submit_info', kwargs={'article_id': new_article.pk}))

    template = 'submission/start.html'
    context = {'form': form}

    return render(request, template, context)
示例#2
0
def start(request, type=None):
    """
    Starts the submission process, presents various checkboxes and then creates a new article.
    :param request: HttpRequest object
    :param type: string, None or 'preprint'
    :return: HttpRedirect or HttpResponse
    """
    form = forms.ArticleStart(journal=request.journal)

    if not request.user.is_author(request):
        request.user.add_account_role('author', request.journal)

    if request.POST:
        form = forms.ArticleStart(request.POST, journal=request.journal)

        if form.is_valid():
            new_article = form.save(commit=False)
            new_article.owner = request.user
            new_article.journal = request.journal
            new_article.current_step = 1
            new_article.article_agreement = logic.get_agreement_text(
                request.journal)
            new_article.save()

            if type == 'preprint':
                preprint_models.Preprint.objects.create(article=new_article)

            if setting_handler.get_setting('general',
                                           'user_automatically_author',
                                           request.journal).processed_value:
                logic.add_self_as_author(request.user, new_article)

            return redirect(
                reverse('submit_info', kwargs={'article_id': new_article.pk}))

    template = 'admin/submission/start.html'
    context = {'form': form}

    return render(request, template, context)