remove unused search methods
[wolnelektury.git] / src / newsletter / models.py
1 # -*- coding: utf-8 -*-
2 import hashlib
3
4 from django.db.models import Model, EmailField, DateTimeField, BooleanField
5 from django.utils.translation import ugettext_lazy as _
6 from django.conf import settings
7
8
9 class Subscription(Model):
10     email = EmailField(verbose_name=_('email address'), unique=True)
11     active = BooleanField(default=True, verbose_name=_(u'active'))
12     created_at = DateTimeField(auto_now_add=True)
13     last_modified = DateTimeField(auto_now=True)
14
15     class Meta:
16         verbose_name = _('subscription')
17         verbose_name_plural = _('subscriptions')
18
19     def __unicode__(self):
20         return self.email
21
22     def hashcode(self):
23         return hashlib.sha224(self.email + settings.SECRET_KEY).hexdigest()[:30]