Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

check type of django messages

{% if messages %}
        {% for message in messages %}
            {% if message.tags == 'success'%}
                <script>M.toast({html: "{{message}}", classes: 'green rounded', displayLength:2000});</script>
            {% elif message.tags == 'info'%}
                <script>M.toast({html: "{{message}}", classes: 'blue rounded', displayLength:2000});</script>
            {% elif message.tags == 'warning'%}
                <script>M.toast({html: "{{message}}", classes: 'orange rounded', displayLength:10000});</script>
            {% elif message.tags == 'error'%}
                <script>M.toast({html: "{{message}}", classes: 'red rounded', displayLength:10000});</script>
            {% endif %}
        {% endfor %}
    {% endif %}
Comment

PREVIOUS NEXT
Code Example
Python :: download python 2.7 for windows 10 
Python :: How to convert string date to datetime format in python 
Python :: read json in python 
Python :: Python JSON API example 
Python :: python character list to string 
Python :: how to check if a file exists in python 
Python :: python array extend 
Python :: with suppress python 
Python :: add caption to plot python 
Python :: int to ascii python 
Python :: python read and write pdf data 
Python :: how to access dataframe row by datetime index 
Python :: Python function to compute factorial of a number. 
Python :: how to get the remainder in python 
Python :: python - count total numeber of row in a dataframe 
Python :: pandas print a single row 
Python :: django response headers 
Python :: install a lower version of python using conda 
Python :: python3 shebang line 
Python :: underscore in python 
Python :: Python Changing Directory 
Python :: python working directory 
Python :: python selenium click element 
Python :: python capitalize every first letter 
Python :: python find digits in string 
Python :: How to rotate the 2D vector by degree in Python: 
Python :: sort rows by values dataframe 
Python :: pip install covid 
Python :: python subtract list from list 
Python :: plt text matplotlib white background 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =