users can disable notifications

This commit is contained in:
Élie Bouttier 2014-09-04 20:12:38 -07:00
parent 4a61d463bd
commit f420dd98ac
9 changed files with 82 additions and 22 deletions

View file

@ -14,6 +14,18 @@ class User(AbstractUser):
class Meta:
ordering = ['username']
NOTIFICATIONS_NEVER = 0 # do not change: used as boolean value
NOTIFICATIONS_OTHERS = 1
NOTIFICATIONS_ALWAYS = 2
NOTIFICATIONS_CHOICES = (
(NOTIFICATIONS_NEVER, 'Never'),
(NOTIFICATIONS_OTHERS, 'Ignore my actions'),
(NOTIFICATIONS_ALWAYS, 'Always'),
)
notifications = models.IntegerField(choices=NOTIFICATIONS_CHOICES,
default=NOTIFICATIONS_OTHERS)
@property
def teams(self):
query = Q(groups__in=self.groups.all()) | Q(users=self)