django.contrib.messages.INFO - python examples

Here are the examples of the python api django.contrib.messages.INFO taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

89 Examples 7

3 View Complete Implementation : providers.py
Copyright MIT License
Author : aureplop
    def message_suggest_caslogout_on_logout_level(self, request):
        """Level of the logout message issued on user logout.

        By default, it returns
        ``settings.SOCIALACCOUNT_PROVIDERS[self.id]['MESSAGE_SUGGEST_CASLOGOUT_ON_LOGOUT_LEVEL']``
        or ``messages.INFO``.

        Notes:
            The ``request`` argument is the one trigerring the emission of the
            signal ``user_logged_out``.

        """
        return (
            self.get_settings()
            .get('MESSAGE_SUGGEST_CASLOGOUT_ON_LOGOUT_LEVEL', messages.INFO)
        )

3 View Complete Implementation : views.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
@editor_user_required
def news_config(request):
    plugin = models.Plugin.objects.get(name='News')
    number_of_articles = setting_handler.get_plugin_setting(plugin, 'number_of_articles', request.journal, create=True,
                                                            pretty='Number of Articles').value
    if request.POST:
        number_of_articles = request.POST.get('number_of_articles')
        setting_handler.save_plugin_setting(plugin, 'number_of_articles', number_of_articles, request.journal)
        messages.add_message(request, messages.INFO, 'Number of articles updated.')
        return redirect(reverse('home_settings_index'))

    template = 'news_settings.html'
    context = {
        'number_of_articles': number_of_articles,
    }

    return render(request, template, context)

3 View Complete Implementation : logic.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def notify_author(request, article):
    kwargs = {
        'request': request,
        'article': article,
        'user_message': request.POST.get('notify_author_email', 'No message from Editor.'),
        'section_editors': request.POST.get('section_editors', False),
        'peer_reviewers': request.POST.get('peer_reviewers', False),
    }

    event_logic.Events.raise_event(event_logic.Events.ON_AUTHOR_PUBLICATION,
                                   task_object=article,
                                   **kwargs)

    article.fixedpubcheckitems.notify_the_author = True
    article.fixedpubcheckitems.save()
    messages.add_message(request, messages.INFO, 'Author notified.')

3 View Complete Implementation : logic.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def handle_delete_subject(request):
    subject_id = request.POST.get('delete')

    subject = get_object_or_404(models.Subject, pk=subject_id)
    messages.add_message(request, messages.INFO, 'Subject "{subject}" deleted.'.format(subject=subject.name))
    subject.delete()
    return redirect(reverse('preprints_subjects'))

3 View Complete Implementation : logic.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def unpublish_preprint(request, preprint):
    "Marks a preprint as unpublished."
    preprint.date_accepted = None
    preprint.date_declined = None
    preprint.date_published = None
    preprint.preprint_decision_notification = False
    preprint.stage = submission_models.STAGE_PREPRINT_REVIEW
    preprint.save()
    messages.add_message(request, messages.INFO, 'This preprint has been unpublished')

3 View Complete Implementation : logic.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def handle_closing_active_task(request, article):
    if article.proofingastignment.current_proofing_round().has_active_tasks:
        for task in article.proofingastignment.current_proofing_round().proofingtask_set.all():
            if not task.completed:
                task.completed = timezone.now()
                task.cancelled = True
                task.save()

                kwargs = {
                    'article': article,
                    'proofing_task': task,
                    'request': request,
                    'user_content_message': request.POST.get('note_to_proofreaders', None)
                }
                event_logic.Events.raise_event(event_logic.Events.ON_CANCEL_PROOFING_TASK,
                                               task_object=article,
                                               **kwargs)
    else:
        messages.add_message(request, messages.INFO, 'There are no active tasks.')

3 View Complete Implementation : logic.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def handle_proof_decision(request, proofing_task_id, decision):
    proofing_task = get_object_or_404(models.ProofingTask,
                                      proofreader=request.user,
                                      pk=proofing_task_id)
    if decision == 'accept':
        proofing_task.accepted = timezone.now()
    elif decision == 'decline':
        proofing_task.completed = timezone.now()
    proofing_task.save()
    kwargs = {'request': request, 'proofing_task': proofing_task, 'decision': decision}
    event_logic.Events.raise_event(event_logic.Events.ON_PROOFREADER_TASK_DECISION,
                                   task_object=proofing_task.round.astignment.article,
                                   **kwargs)
    messages.add_message(request, messages.INFO, 'Proofing Task {0} decision: {1}'.format(proofing_task_id, decision))

3 View Complete Implementation : logic.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def handle_typeset_decision(request, typeset_task_id, decision):
    typeset_task = get_object_or_404(
        models.TypesetterProofingTask,
        typesetter=request.user,
        pk=typeset_task_id,
        proofing_task__round__astignment__article__journal=request.journal,
    )
    if decision == 'accept':
        typeset_task.accepted = timezone.now()
    elif decision == 'decline':
        typeset_task.completed = timezone.now()
    typeset_task.save()
    kwargs = {'request': request, 'typeset_task': typeset_task, 'decision': decision}
    event_logic.Events.raise_event(event_logic.Events.ON_PROOFING_TYPESET_DECISION,
                                   task_object=typeset_task.proofing_task.round.astignment.article,
                                   **kwargs)
    messages.add_message(request, messages.INFO, 'Typeset Task {0} decision: {1}'.format(typeset_task_id, decision))

3 View Complete Implementation : logic.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def handle_reviewer_form(request, new_reviewer_form):
    account = new_reviewer_form.save(commit=False)
    account.username = account.email
    from core import models as core_models
    account.country = core_models.Country.objects.filter(code='GB')[0]
    account.inssatution = 'N/a'
    account.is_active = True
    account.save()
    account.add_account_role('reviewer', request.journal)
    messages.add_message(request, messages.INFO, 'A new account has been created.')

3 View Complete Implementation : decorators.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def press_only(func):
    """
    Checks that there is no journal object.
    :param func: the function to callback from the decorator
    :return: either the function call or a redirect
    """

    def wrapper(request, *args, **kwargs):
        if not base_check(request):
            return redirect('{0}?next={1}'.format(reverse('core_login'), request.path_info))
        if request.journal:
            messages.add_message(request, messages.INFO, 'This is a press only page.')
            return redirect(reverse('core_manager_index'))

        return func(request, *args, **kwargs)

    return wrapper