Add mode.
[cas.git] / src / emails / models.py
1 from django.db import models
2 from django.utils.translation import ugettext_lazy as _
3
4
5 class Alias(models.Model):
6     source = models.EmailField(_('source'), db_index=True)
7     destination = models.EmailField(_('destination'))
8     mode = models.CharField(
9         _('mode'), max_length=255, default='', blank=True, choices=[
10             ('', _('Forward everything')),
11             ('@FORWARD', _('Do not forward e-mail marked as spam.'))
12         ])
13
14     class Meta:
15         verbose_name = _('alias')
16         verbose_name_plural = _('aliases')
17         ordering = ('source', 'destination')
18
19     def __str__(self):
20         return '{} -> {}'.format(self.source, self.destination)