Source

django-confirmation / confirmation / models.py

from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic

from confirmation.managers import ConfirmationManager



class Confirmation(models.Model):
    """
    Can be used for user activation, but also for
    other purposes where confirmation is required.
    """
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')
    date = models.DateTimeField(auto_now=True)
    key = models.CharField(max_length=32)
    confirmation_type = models.IntegerField(default=1)
    content = models.TextField(blank=True)
    

    objects = ConfirmationManager()
    
    class Meta:
        db_table = "confirmation"

    def __unicode__(self):
        return self.key