Commits

offline  committed d8de754

get_url method added

  • Participants
  • Parent commits 9be452e

Comments (0)

Files changed (1)

File confirmation/models.py

 from django.db import models
 from django.contrib.contenttypes.models import ContentType
 from django.contrib.contenttypes import generic
+from django.core.urlresolvers import reverse
 
 from confirmation.managers import ConfirmationManager
 
     date = models.DateTimeField(auto_now=True)
     key = models.CharField(max_length=32)
     confirmation_type = models.IntegerField(default=1)
-    content = models.TextField(blank=True)
+    content = models.TextField(blank=True, null=True)
     
 
     objects = ConfirmationManager()
     
+    
+    def get_url(self, request):
+        url = request.build_absolute_uri(reverse('confirmation'))
+        url += '?key=%s&type=%s' % (self.key, self.confirmation_type)
+        return url
+    
     class Meta:
         db_table = "confirmation"