操作步骤:
1.导入包
from django.contrib import messages
2.设置提示信息
message.success(request,'需要提示的信息内容!')
3.前端对应代码
<script type="text/javascript">
{% for msg in messages %}
alert('{{ msg.message }}');
{% endfor %}
</script>
from django.contrib import messages
message.success(request,'需要提示的信息内容!')
<script type="text/javascript">
{% for msg in messages %}
alert('{{ msg.message }}');
{% endfor %}
</script>