From baa23694365e35b67677c6756f38bfc3290516d6 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Thu, 1 Nov 2018 01:07:33 +0100 Subject: [PATCH] Non member can't buy connexion : They need to pay membership --- cotisations/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cotisations/models.py b/cotisations/models.py index 9f294f6b..6dd63b6f 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -624,6 +624,10 @@ class Article(RevMixin, AclMixin, models.Model): objects_pool = cls.objects.filter( Q(type_user='All') | Q(type_user='Adherent') ) + if not target_user.is_adherent(): + objects_pool = objects_pool.filter( + Q(type_cotisation='All') | Q(type_cotisation='Adhesion') + ) if user.has_perm('cotisations.buy_every_article'): return objects_pool return objects_pool.filter(available_for_everyone=True) @@ -874,4 +878,3 @@ def cotisation_post_delete(**_kwargs): """ regen('mac_ip_list') regen('mailing') -