- def form_args(self, request, *args, **kwargs):
+ 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)
+
+ def get_object(self, request, *args, **kwargs):
+ """Override to parse view args and get some associated data."""
+ return None
+
+ def form_args(self, request, obj):