I am using Django generic views to create a success message, I searched a bit in stack overflow and seems like similar solution is not working in my case. views.py
class PostCreateView(CreateView):
model = BlogPost
template_name = 'blogs/blog-form.html'
fields = [
'title',
'content',
'image'
]
success_message = 'Post added successfully!'
and here is the template wherein the messages should pop up.
<div class="wrapper">
{% if messages %}
{% for message in messages %}
<div class="alert alert-success my-3">
{{ message }}
</div>
{% endfor %}
{% endif %}
<a href="{% url 'blog:blog_update' object.slug %}" class="btn btn-success btn-sm">Update</a>
<a href="{% url 'blog:blog_delete' object.slug %}" class="btn btn-danger btn-sm">Delete</a>
<br><br>
<img src="{{ object.image.url }}" class="image_in_list" alt="">
<h2 class="display-4">{{ object.title }}</h2>
<p>{{ object.content }}</p>
</div>
any help would be appreciated so much, thanks.