+ def redirect_or_refresh(self, request, path, message=None):
+ """If the form is AJAX, refresh the page. If not, go to `path`."""
+ if request.is_ajax():
+ output = "<script>window.location.reload()</script>"
+ if message:
+ output = "<div class='normal-text'>" + message + "</div>" + output
+ return HttpResponse(output);
+ else:
+ return HttpResponseRedirect(path)
+