diff --git a/club/migrations/0004_auto_20160915_1057.py b/club/migrations/0004_auto_20160915_1057.py new file mode 100644 index 00000000..05bd4958 --- /dev/null +++ b/club/migrations/0004_auto_20160915_1057.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('club', '0003_auto_20160902_2042'), + ] + + operations = [ + migrations.AlterField( + model_name='membership', + name='user', + field=models.ForeignKey(verbose_name='user', related_name='memberships', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/club/models.py b/club/models.py index 19b2caa1..0ed5ab02 100644 --- a/club/models.py +++ b/club/models.py @@ -141,7 +141,7 @@ class Membership(models.Model): A User is currently member of all the Clubs where its Membership has an end_date set to null/None. Otherwise, it's a past membership kept because it can be very useful to see who was in which Club in the past. """ - user = models.ForeignKey(User, verbose_name=_('user'), related_name="membership", null=False, blank=False) + user = models.ForeignKey(User, verbose_name=_('user'), related_name="memberships", null=False, blank=False) club = models.ForeignKey(Club, verbose_name=_('club'), related_name="members", null=False, blank=False) start_date = models.DateField(_('start date')) end_date = models.DateField(_('end date'), null=True, blank=True) @@ -176,8 +176,8 @@ class Membership(models.Model): """ Method to see if that object can be edited by the given user """ - if user.membership: - ms = user.membership.filter(club=self.club, end_date=None).first() + if user.memberships: + ms = user.memberships.filter(club=self.club, end_date=None).first() return (ms and ms.role >= self.role) or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) diff --git a/core/templates/core/user_detail.jinja b/core/templates/core/user_detail.jinja index 8bf4075c..0b31dc14 100644 --- a/core/templates/core/user_detail.jinja +++ b/core/templates/core/user_detail.jinja @@ -52,7 +52,7 @@ -{% if user.membership.filter(end_date=None).exists() or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) or user == profile %} +{% 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 #}

{% if get_subscriber(profile).is_subscribed() %} diff --git a/core/templates/core/user_tools.jinja b/core/templates/core/user_tools.jinja index bec08530..9a3adf17 100644 --- a/core/templates/core/user_tools.jinja +++ b/core/templates/core/user_tools.jinja @@ -42,7 +42,7 @@ {% if user.is_in_group(settings.SITH_GROUPS['accounting-admin']['name']) or user.is_root %}

  • {% trans %}General accounting{% endtrans %}
  • {% endif %} - {% for m in user.membership.filter(end_date=None).filter(role__gte=7).all() -%} + {% for m in user.memberships.filter(end_date=None).filter(role__gte=7).all() -%} {%- for b in m.club.bank_accounts.all() %}
  • {% trans %}Bank account: {% endtrans %} {{ b }}
  • @@ -58,7 +58,7 @@

    {% trans %}Club tools{% endtrans %}

    diff --git a/doc/TW_Skia/Rapport.tex b/doc/TW_Skia/Rapport.tex index e9e24c37..9183987d 100644 --- a/doc/TW_Skia/Rapport.tex +++ b/doc/TW_Skia/Rapport.tex @@ -341,7 +341,7 @@ tous les autres.

    Clubs