From 4e8873226fb9b0ce371b94fd07532c58daef3e3e Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Tue, 18 Jul 2017 13:55:09 +0200 Subject: [PATCH] Oops --- vim | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 vim diff --git a/vim b/vim deleted file mode 100644 index 930386b..0000000 --- a/vim +++ /dev/null @@ -1,56 +0,0 @@ -diff --git a/communication/models.py b/communication/models.py -index 220d29d..8a89504 100644 ---- a/communication/models.py -+++ b/communication/models.py -@@ -1,5 +1,4 @@ - from django.db import models --from django.conf import settings - from django.contrib.auth.models import Group - from django.contrib.auth import get_user_model - from django.contrib.contenttypes.fields import ( -@@ -16,31 +15,41 @@ class Subscription(models.Model): - object_id = models.PositiveIntegerField() - content_object = GenericForeignKey('content_type', 'object_id') - -+ class Meta: -+ abstract = True -+ - - class UserSubscription(Subscription): -- user = models.ForeignKey(settings.AUTH_USER_MODEL) -+ user = models.ForeignKey(User) - is_unsub = models.BooleanField( - _("désinscription"), - default=False - ) - -+ class Meta: -+ verbose_name = _("souscription utilisateur") -+ - - class GroupSubscription(Subscription): - group = models.ForeignKey(Group) - -+ class Meta: -+ verbose_name = _("souscription en groupe") -+ - - class SubscriptionMixin(models.Model): - subscribed_users = GenericRelation(UserSubscription) - subscribed_groups = GenericRelation(GroupSubscription) - -- def get_unique_users(self): -+ def get_manual_subscribers(self): - return self.subscribed_users.filter(is_unsub=False) - -- def get_group_users(self): -+ def get_subscribers_from_groups(self): - return User.objects.filter(group__in=self.subscribed_groups.all()) - - def get_all_subscribers(self): -- return (self.get_unique_users().union(self.get_group_users()) -+ return (self.get_manual_subscribers() -+ .union(self.get_subscribers_from_groups()) - .exclude(is_unsub=True)) - - class Meta: