1. tejinderss
  2. django-registration

Commits

tejinderss  committed 7504a91

revertng back

  • Participants
  • Parent commits 8bb53ec
  • Branches default

Comments (0)

Files changed (1)

File registration/views.py

View file
  • Ignore whitespace
         # success_url may be a simple string, or a tuple providing the
         # full argument set for redirect(). Attempting to unpack it
         # tells us which one it is.
-        splitted = False
-        to = success_url
         try:
             to, args, kwargs = success_url
-            splitted = True
+            return redirect(to, *args, **kwargs)
         except ValueError:
-            pass
-
-        if request.is_ajax():
-            context = {
-                'redirect_url': resolve_url(to),
-            }
-            return HttpResponse(json.dumps(context),
-                                mimetype="application/json")
-        if splitted:
-            return redirect(to, *args, **kwargs)
-        else:
-            return redirect(to)
-
-    def form_invalid(self, form):
-        """
-        We haz errors in the form. If ajax, return them as json.
-        Otherwise, proceed as normal.
-        """
-        if self.request.is_ajax():
-            return HttpResponseBadRequest(json.dumps(form.errors),
-                                          mimetype="application/json")
-        return super(RegistrationView, self).form_invalid(form)
+            return redirect(success_url)
 
     def registration_allowed(self, request):
         """