Hello, I am working on Django by Example as a newb and am having issues in ch. 2...
we are setting up a commenting system for blog posts and everything works except the form stays populated and there is no refresh after successfully posting...the page is supposed to refresh and the form be cleared... views.py *...from .models import Commentfrom .forms import CommentForm#a comment was postedcomments =post.comments.filter(active=True)if request.method == "POST": # a comment was posted comment_form =CommentForm(data=request.POST) if comment_form.is_valid(): new_comment = comment_form.save(commit=False) new_comment.post = post new_comment.save()else: comment_form = CommentForm()...* post_detail.html *{% if new_comment %} <h2>Your comment has been added.</h2>{% else %} <h2>Add a new comment.</h2> <form action="." method="post"> {{ comment_form.as_p }} {% csrf_token %} <p><input type="submit" value="Add comment"></p> </form>{% endif %} * the problem is that when displaying the actual page everything works except that the form is still populated and can be resubmitted endlessly with the same data. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c667f3ba-4a68-45cc-b11d-72e4d3f73246%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.