diff --git a/core/models.py b/core/models.py index 136469df..fb5c4137 100644 --- a/core/models.py +++ b/core/models.py @@ -231,6 +231,16 @@ class User(AbstractBaseUser): def is_root(self): return self.is_superuser or self.groups.filter(name=settings.SITH_GROUPS['root']['name']).exists() + @property + def is_office(self): + from club.models import Club + return Club.objects.filter(unix_name='laverie').first().get_membership_for(self) + + @property + def is_launderette(self): + from club.models import Club + return Club.objects.filter(unix_name='').first().get_membership_for(self) + def save(self, *args, **kwargs): create = False with transaction.atomic(): diff --git a/core/templates/core/user_detail.jinja b/core/templates/core/user_detail.jinja index f9696be0..e4d326b1 100644 --- a/core/templates/core/user_detail.jinja +++ b/core/templates/core/user_detail.jinja @@ -56,14 +56,16 @@ {# if the user is member of a club, he can view the subscription state #}
{% if get_subscriber(profile).is_subscribed() %}
- {% trans subscription_end=get_subscriber(profile).subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}
- {% if user == profile or user.is_root %}
- {% trans %}Account number: {% endtrans %}{{ profile.customer.account_id }}
+ {% if user == profile or user.is_root or user.is_office %}
+ {% trans subscription_end=get_subscriber(profile).subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}
+ {% trans %}Account number: {% endtrans %}{{ profile.customer.account_id }}
+ {% endif %}
+ {% if user == profile or user.is_root or user.is_office or user.is_launderette %}
+ {# Shows tokens bought by the user #}
+ {{ show_tokens(profile) }}
+ {# Shows slots took by the user #}
+ {{ show_slots(profile) }}
{% endif %}
- {# Shows tokens bought by the user #}
- {{ show_tokens(profile) }}
- {# Shows slots took by the user #}
- {{ show_slots(profile) }}
{% else %}
{% trans %}Not subscribed{% endtrans %}
{% if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) %}