title: How to use toastr in Django for success or fail message
body: <p>I have been using Django message framework to show the success or failure message in my application. But I want the UI to be good so I found out that toastr is a good way to display messages to the user. But I am not sure how to use it. Please guide me through this.</p>
  
  <p>The function below saves the user to the database and when the user info is save a message is displayed:</p>
  
  <pre><code>def addSubscriber(request):
      template = 'addSubscriber.html'
  
      if request.method == 'POST':
          form = addSubsForm(request.POST)
          if form.is_valid():
              f = form.save(commit=False)
              f.save()
              messages.success(request, "The Subscriber has been successfully added")
              return redirect('report')
  
          else:
              messages.error(request, "Sorry the data has not been entered to the database")
  
      else:
          form = addSubsForm()
  
      return render(request, template, {'form': form})
  </code></pre>
  
  <p>The following template shows the display of the message:</p>
  
  <pre><code>  {% if messages %}
              &lt;ul class="messages"&gt;
                  {% for message in messages %}
                  &lt;li{% if message.tags %} class="{{ message.tags }}"{% endif %}&gt;{{ message }}&lt;/li&gt;
                  {% endfor %}
              &lt;/ul&gt;
          {% endif %}
  </code></pre>