diff --git a/core/management/commands/populate.py b/core/management/commands/populate.py index 06c5d3f3..0c661b1d 100644 --- a/core/management/commands/populate.py +++ b/core/management/commands/populate.py @@ -611,6 +611,7 @@ Welcome to the wiki page! mde.products.add(cons) mde.products.add(dcons) mde.sellers.add(skia) + mde.save() eboutic = Counter.objects.filter(name="Eboutic").first() @@ -935,6 +936,7 @@ Welcome to the wiki page! # Add barman to counter c = Counter.objects.get(id=2) c.sellers.add(User.objects.get(pk=krophil.pk)) + mde.sellers.add(sli) c.save() # Create an election diff --git a/counter/models.py b/counter/models.py index 3d3fef5b..dd3de7d9 100644 --- a/counter/models.py +++ b/counter/models.py @@ -22,6 +22,7 @@ # # +from sith.settings import SITH_MAIN_CLUB from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils import timezone @@ -39,7 +40,7 @@ import os import base64 import datetime -from club.models import Club +from club.models import Club, Membership from accounting.models import CurrencyField from core.models import Group, User, Notification from subscription.models import Subscription @@ -342,6 +343,14 @@ class Counter(models.Model): """ return [b.id for b in self.get_barmen_list()] + def can_refill(self): + is_ae_member = False + ae = Club.objects.get(unix_name=SITH_MAIN_CLUB["unix_name"]) + for barman in self.get_barmen_list(): + if ae.get_membership_for(barman): + is_ae_member = True + return is_ae_member + class Refilling(models.Model): """ diff --git a/counter/templates/counter/counter_click.jinja b/counter/templates/counter/counter_click.jinja index 06cb191b..b9238b89 100644 --- a/counter/templates/counter/counter_click.jinja +++ b/counter/templates/counter/counter_click.jinja @@ -107,7 +107,7 @@ - {% if counter.type == 'BAR' %} + {% if (counter.type == 'BAR' and barmens_can_refill) %}