Questions tagged [django-messages]

Notification messages framework for Django

The messages framework

Quite commonly in web applications, you need to display a one-time notification message (also known as “flash message”) to the user after processing a form or some other types of user input.

For this, Django provides full support for cookie- and session-based messaging, for both anonymous and authenticated users. The messages framework allows you to temporarily store messages in one request and retrieve them for display in a subsequent request (usually the next one). Every message is tagged with a specific level that determines its priority (e.g., info, warning, or error).

155 questions
0
votes
2 answers

How to make Django messages framework play nicely with i18n?

Using django 4.0.6 I was using the messages framework to display messages when users successfully completed a form. Then I added i18n: When the default language is selected, messages are shown on the second screen after the form is submitted, not…
John
  • 949
  • 1
  • 9
  • 20
0
votes
0 answers

Is it possible to deliver django toast messages via frontend

Tryna achieve sending notifications through Javascript logic instead of Django views, I want to replace alert() in this Javascript function with Django contrib messages(toasts). Something that would look like this in views messages.success(request,…
betty_
  • 61
  • 10
0
votes
1 answer

Show messages using django messages framework from one particular view

I'm using Django messages framework to show a success message in my contact page template when contact form submission is succeed. since installed app, middlewares and context processor for messages are set in settings.py all the messages that are…
Imtiaz Ahmed
  • 123
  • 3
  • 12
0
votes
1 answer

Is there a way to control the messages after redirect or even clear messages?

Is there a way for me to stop the other validations after the first redirect in views.py from django.contrib import messages # from django.core.exceptions import ValidationError from django.shortcuts import render, redirect def register(request): …
Sammy Dasaolu
  • 17
  • 1
  • 6
0
votes
3 answers

django messages framwork returning None when printed

I am new to django, i have stuck into an obvious issue which i cant unfold, at the form successful submission i have, put a message on the main home page where the user will be redirect to, the issue is its not returning the message.see…
Muhammad huzaifa
  • 144
  • 2
  • 10
0
votes
1 answer

How to render a django message after page refresh

Hi i am trying to show a message but the django message is not showing. The way i want to access this is if i send a webhook to a function in python for example. ill send a webhook post request using postman , and i will receive the message But if i…
0
votes
0 answers

Displaying messages through django signals

I'm looking to make a django app that uses signals. (using django signals) There I would like to run some functions, and based on which output they give, send a message within the webpage. so for example, if the function fails i want to send a…
gmv
  • 199
  • 1
  • 1
  • 11
0
votes
1 answer

how can I send a message from a view to another view when use reverse in Django

I have 2 views for inserting phone number and another view is used to verify OTP code, now I want to send a message from verify view to the previous view that shows verify code is not valid or the time has expired. this view just check phone number…
0
votes
1 answer

Unable to see messages using django register

I have an app with views.py as follows from django.shortcuts import render,redirect from django.contrib.auth.models import User, auth from django.contrib import messages # Create your views here. def register(request): if request.method ==…
0
votes
1 answer

Django - Send notification to user after new like

I'm searching for a method to notify an user if another user liked his/her post. For example instagram is giving you an alert: "this_user liked your post". Is there a way to do with djangos integrated messages framework? So far I got the logic for…
Dariun
  • 327
  • 3
  • 14
0
votes
1 answer

How to get currently logged-in user in signals.py file?

I'm making a todo app and one of it's functionalities is to send an email to the user that his task was overdue. Part of the views.py file: from .models import Todo from django.utils import timezone from .signals import overdue def index(request): …
0
votes
2 answers

Store messages after showing in the template

I would like to store the last messages to get a chance for the user to check it again. How can I save it, after show? before show? Do I need to implement a db model?
Paolo Vezzola
  • 105
  • 1
  • 5
0
votes
1 answer

Django Messaging Framework in the save() function

I am checking if a model instance already exists and if does I want to send a message saying "Name already exists". As there is not request in def save(), is there any other way to send a message via Django message framework or something else?? def…
0
votes
2 answers

how to use django message framework for @login_required to show message

I am using @login required decorator in my most of views so what I want is to use message in my login page telling user if you want to open that page you have to login first so how I can achieve that I know I cannot achieve that on my views so…
0
votes
1 answer

How can I make a receiver listen to a user-specific signal in Django?

I'm writing a Django blog site where blog posts need to be approved by an admin (superuser) before they can be posted. In my BlogPost model, there is a Boolean field "approved". I've managed to implement all of this. However, I also want the user to…