offline committed d2fdbf5

user now can be redirected after succeessfull confirmation

Comments (0)

Files changed (3)


 class ConfirmationManager(models.Manager):
-    def create(self, obj, confirmation_type, content=None):
+    def create(self, obj, confirmation_type, content="", redirect_url=""):
         content_type = ContentType.objects.get_for_model(obj)
         key = generate_hash()
         return super(ConfirmationManager, self).create(content_type=content_type,
-                                      ,
-                                                key=key,
-                                                confirmation_type=confirmation_type,
-                                                content=content)
+                                              ,
+                                                        key=key,
+                                                        confirmation_type=confirmation_type,
+                                                        content=content,
+                                                        redirect_url=redirect_url
+                                                        )
     def get(self, key, confirmation_type=1):
                 raise Http404()


     date = models.DateTimeField(auto_now=True)
     key = models.CharField(max_length=32)
     confirmation_type = models.IntegerField(default=1)
-    content = models.TextField(blank=True, null=True)
+    content = models.TextField(blank=True)
+    redirect_url = models.SlugField(max_length=255, blank=True)
+    # overriding get and create methods
     objects = ConfirmationManager()
     def get_url(self, request):
         url = request.build_absolute_uri(reverse('confirmation'))
         url += '?key=%s&type=%s' % (self.key, self.confirmation_type)


-from confirmation.models import Confirmation
-from confirmation import signals
+from django.shortcuts import redirect
 from annoying.decorators import render_to
+from confirmation.models import Confirmation
+from confirmation import signals
+    if confirmation.redirect_url:
+        return redirect(confirmation.redirect_url)
     return {}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.