Big refactor: remove Subscriber class

This commit is contained in:
Skia
2016-12-10 01:58:30 +01:00
parent 0d4b697079
commit 28431ec9be
19 changed files with 51 additions and 109 deletions

View File

@ -35,15 +35,15 @@
{%- endmacro %}
{% macro user_subscription(user) %}
{% trans subscription_end=get_subscriber(user).subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}<br/>
{% trans subscription_end=user.subscriptions.last().subscription_end %}Subscribed until {{ subscription_end }}{% endtrans %}<br/>
{% trans %}Account number: {% endtrans %}{{ user.customer.account_id }}<br/>
{%- endmacro %}
{% macro show_slots(user) %}
{% if get_subscriber(user).slots.filter(start_date__gte=timezone.now()).exists() %}
{% if user.slots.filter(start_date__gte=timezone.now()).exists() %}
<h5>{% trans %}Slot{% endtrans %}</h5>
<ul>
{% for i in get_subscriber(user).slots.filter(start_date__gte=timezone.now().replace(tzinfo=None)).all() %}
{% for i in user.slots.filter(start_date__gte=timezone.now().replace(tzinfo=None)).all() %}
<li>{{ i.get_type_display() }} - {{i.machine.launderette }}, {{ i.start_date|date("l j") }} : {{ i.start_date|time(DATETIME_FORMAT) }}</li>
{% endfor %}
</ul>
@ -51,10 +51,10 @@
{% endmacro %}
{% macro show_tokens(user) %}
{% if get_subscriber(user).tokens.exists() %}
{% if user.tokens.exists() %}
<h5>{% trans %}Tokens{% endtrans %}</h5>
<ul>
{% for i in get_subscriber(user).tokens.all() %}
{% for i in user.tokens.all() %}
<li>{{ i }}</li>
{% endfor %}
</ul>
@ -65,4 +65,4 @@
{% if user == profile or user.is_root or user.is_board_member %}
<a href="{{ url("core:user_godfathers_delete", user_id=profile.id, godfather_id=godfather.id, is_father=is_father) }}">{% trans %}Delete{% endtrans %}</a>
{% endif %}
{% endmacro %}
{% endmacro %}

View File

@ -54,7 +54,7 @@
{% if user.memberships.filter(end_date=None).exists() or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user == profile %}
{# if the user is member of a club, he can view the subscription state #}
<p>
{% if get_subscriber(profile).is_subscribed() %}
{% if profile.is_subscribed() %}
{% if user == profile or user.is_root or user.is_board_member %}
{{ user_subscription(profile) }}
{% endif %}