The django admin uses django.contrib.messages
, you use it like this:
In your view:
from django.contrib import messages def my_view(request): ... if form.is_valid(): .... messages.success(request, 'Form submission successful')
And in your templates:
{% if messages %} <ul class="messages"> {% for message in messages %} <li {% if message.tags %} class=" {{ message.tags }} " {% endif %}> {{ message }} </li> {% endfor %} </ul> {% endif %}
Related Posts:
- How can I upgrade specific packages using pip and a requirements file?
- How to fix ‘Notice: Undefined index:’ in PHP form action
- How to switch Python versions in Terminal?
- ‘NOT NULL constraint failed’ after adding to models.py
- Send POST data using XMLHttpRequest
- CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False
- “The path python3 (from –python=python3) does not exist” error
- How can I get the file name from request.FILES?
- Django TemplateDoesNotExist?
- Django: no such table: django_session
- Implementing a SOA in Django using celery
- How to read if a checkbox is checked in PHP?
- Django 1.7 upgrade error: AppRegistryNotReady: Apps aren’t loaded yet
- Python/Django: log to console under runserver, log to file under Apache
- What is a NoReverseMatch error, and how do I fix it?
- JavaScript post request like a form submit
- python: can’t open file ‘manage.py’: [Errno 2] No such file or directory
- What’s the difference between “Request Payload” vs “Form Data” as seen in Chrome dev tools Network tab
- What is the use of PYTHONUNBUFFERED in docker file?
- PHP $_POST not working?
- Cannot find command ‘git’ – windows
- How to revert the last migration?
- JavaScript post request like a form submit
- Output Django queryset as JSON
- Getting stuck at Django error: No module named registration
- Django __str__ returned non-string (type NoneType)
- ow to ‘bulk update’ with Django?
- Redirecting to a page after submitting form in HTML
- POST an array from an HTML form without javascript
- Why do I get sqlite error, “unable to open database file”?
- No module named ‘psycopg2’
- django:django.core.exceptions.AppRegistryNotReady: Apps aren’t loaded yet
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock
- laravel updateOrCreate method
- Form inside a table
- $_POST form request with admin-post
- Why is there a class=”screen-reader-text” on my search button?
- Front-End Form Submission in Shortcode
- How to send multipart form data to WordPress endpoint
- How to allow specific extensions and file size to wp_mail attachment?
- How to hook into user registration process Before user registers
- Passing POST data from one WP post to another
- How to add multiple checkbox elements to media attachments?
- How to Submit Post Via cURL & PHP
- jQuery Ajax passing empty parameters to my function?
- Get Admin Email Address From External PHP page
- Adding data to an array in usermeta and displaying it in a loop
- How to take options from form fields and turn them in to links?
- Custom form action to handle data inside a plugin
- Display users uploaded files as posts
- Add new user and site per front end form
- Multiple options pages validation for a plugin
- How can I populate a select element with terms from a custom taxonomy and filter post results?
- How to clear woocommerce checkout form after pageload
- Send billing info from woocommerce checkout page to paypal checkout form
- Ajax fail and get 504 error
- Show success or error messages in Ajax response to WordPress custom registration form
- Avoid updating post when sending POST or GET request to post.php
- Ajaxify Form That Submits To Same Page To Display Post Data [closed]
- I am trying to grab the title and put it in a paypal form select option
- Trying do build a contact form
- Submit Form data to another page via Ajax (WordPress Way)
- Using admin-ajax prevents regular php form submission
- How can I redirect this contact form to a specific permalink
- Sidebar login widget with error print, returns an error
- Stop SPAM from custom form
- Change default login auth
- Creating a form and displaying entry data as a table
- PHP Contact form
- Form submission to another page returning 404 error [duplicate]
- Programming WordPress to send a custom-built form to specified email address
- Where this validating message come from?
- How t Remove Labels from comment Box
- User loggedin as Subscriber form not sending
- Form Post / Session Variables not Working in Query with Pagination
- Is textarea always accesible throught textarea#content in wordpress dashboard for a specific page?
- Populate a custom form with user data [closed]
- Change dynamically the dropdown list value
- How to post frontend login form to a different authentication script from wp-login?
- How to style a list item when the radio input button within that li is :checked
- WordPress custom search form – ignore empty/default input fields upon submission?
- Redirect when user clicks on an image
- Pass form inputs to page content
- Reading POST over admin-ajax.php
- Auto Submit Contact Form 7
- Creating a WordPress addon for ContactForm7 submission (.XML file export)
- Ajax show custom post data form & script
- Complex List Field – Gravity Forms
- How to change number field to text field using JS
- us states dropdown function and echo in theme template files
- Passed variable gets undefined variable error on insert on next page
- Data not saved WordPress Custom Admin Page
- Trouble using wordpress functions in a pop-up modal form
- How to create front-end (editable) WordPress user profile pages?
- Search Results with googlemaps
- WordPress – custom user flow registration approval
- Taxonomy to display form after creation
- Why do I need nginx when I have uWSGI
- Best approach of implementing multi-select/checkboxes for taxonomies?
- Putting form result in my database