Verified Commit fbe2e7f5 authored by erdnaxe's avatar erdnaxe 🎇

Not so atomic, sorry

parent ab616b3f
Pipeline #1341 passed with stage
in 2 minutes and 20 seconds
[run]
source =
adherents
activity
member
note
theme
omit =
adherents/tests/*.py
adherents/migrations/*.py
activity/tests/*.py
activity/migrations/*.py
member/tests/*.py
member/migrations/*.py
note/tests/*.py
note/migrations/*.py
theme/tests/*.py
\ No newline at end of file
......@@ -2,4 +2,4 @@
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
default_app_config = 'adherents.apps.AdherentsConfig'
default_app_config = 'activity.apps.ActivityConfig'
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
......@@ -6,6 +6,6 @@ from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class AdherentsConfig(AppConfig):
name = 'adherents'
verbose_name = _('adherents')
class ActivityConfig(AppConfig):
name = 'activity'
verbose_name = _('activity')
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-16 12:37+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: apps.py:11
msgid "activity"
msgstr "activité"
#: models.py:12 models.py:25
msgid "name"
msgstr "nom"
#: models.py:16
msgid "can invite"
msgstr "peut inviter"
#: models.py:19
msgid "guest entry fee"
msgstr "cotisation de l'entrée invité"
#: models.py:29
msgid "description"
msgstr "description"
#: models.py:35
msgid "type"
msgstr "type"
#: models.py:41
msgid "organizer"
msgstr "organisateur"
#: models.py:47
msgid "attendees club"
msgstr ""
#: models.py:50
msgid "start date"
msgstr "date de début"
#: models.py:53
msgid "end date"
msgstr "date de fin"
# Generated by Django 2.2.3 on 2019-07-16 10:33
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('note', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('member', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Activity',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='name')),
('description', models.TextField(verbose_name='description')),
('date_start', models.DateTimeField(verbose_name='start date')),
('date_end', models.DateTimeField(verbose_name='end date')),
],
),
migrations.CreateModel(
name='ActivityType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='name')),
('can_invite', models.BooleanField(verbose_name='can invite')),
('guest_entry_fee', models.PositiveIntegerField(verbose_name='guest entry fee')),
],
),
migrations.CreateModel(
name='Guest',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('entry', models.DateTimeField(null=True)),
('activity', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='activity.Activity')),
('entry_transaction', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='note.Transaction')),
('inviter', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='activity',
name='activity_type',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='activity.ActivityType', verbose_name='type'),
),
migrations.AddField(
model_name='activity',
name='attendees_club',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='member.Club', verbose_name='attendees club'),
),
migrations.AddField(
model_name='activity',
name='organizer',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='member.Club', verbose_name='organizer'),
),
]
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.conf import settings
class ActivityType(models.Model):
name = models.CharField(
verbose_name=_('name'),
max_length=255,
)
can_invite = models.BooleanField(
verbose_name=_('can invite'),
)
guest_entry_fee = models.PositiveIntegerField(
verbose_name=_('guest entry fee'),
)
class Activity(models.Model):
name = models.CharField(
verbose_name=_('name'),
max_length=255,
)
description = models.TextField(
verbose_name=_('description'),
)
activity_type = models.ForeignKey(
ActivityType,
on_delete=models.PROTECT,
related_name='+',
verbose_name=_('type'),
)
organizer = models.ForeignKey(
'member.Club',
on_delete=models.PROTECT,
related_name='+',
verbose_name=_('organizer'),
)
attendees_club = models.ForeignKey(
'member.Club',
on_delete=models.PROTECT,
related_name='+',
verbose_name=_('attendees club'),
)
date_start = models.DateTimeField(
verbose_name=_('start date'),
)
date_end = models.DateTimeField(
verbose_name=_('end date'),
)
class Guest(models.Model):
activity = models.ForeignKey(
Activity,
on_delete=models.PROTECT,
related_name='+',
)
name = models.CharField(
max_length=255,
)
inviter = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.PROTECT,
related_name='+',
)
entry = models.DateTimeField(
null=True,
)
entry_transaction = models.ForeignKey(
'note.Transaction',
on_delete=models.PROTECT,
)
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
default_app_config = 'member.apps.MemberConfig'
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class MemberConfig(AppConfig):
name = 'member'
verbose_name = _('member')
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-08 13:45+0200\n"
"POT-Creation-Date: 2019-07-16 12:37+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -18,34 +18,102 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: models.py:26
#: apps.py:11
msgid "member"
msgstr "adhérent"
#: models.py:24
msgid "profile picture"
msgstr "image de profil"
#: models.py:29
msgid "phone number"
msgstr "numéro de téléphone"
#: models.py:30
#: models.py:36
msgid "section"
msgstr "section"
#: models.py:31
#: models.py:37
msgid "e.g. \"1A0\", \"9A♥\", \"SAPHIRE\""
msgstr "e.g. \"1A0\", \"9A♥\", \"SAPHIRE\""
#: models.py:35 models.py:36
#: models.py:41
msgid "address"
msgstr "adresse"
#: models.py:47 models.py:61
msgid "paid"
msgstr "payé"
#: models.py:52 models.py:53
msgid "user profile"
msgstr "profil utilisateur"
#: models.py:52
msgid "date"
msgstr "date"
#: models.py:57
msgid "amount"
msgstr "montant"
#: models.py:65
msgid "email"
msgstr "courriel"
#: models.py:61
#: models.py:70
msgid "membership fee"
msgstr "cotisation"
#: models.py:62
msgid "membership fees"
msgstr "cotisations"
#: models.py:74
msgid "membership duration"
msgstr "durée de l'adhésion"
#: models.py:75
msgid "The longest time a membership can last (NULL = infinite)."
msgstr "La durée maximale d'une adhésion (NULL = infinie)."
#: models.py:79
msgid "membership start"
msgstr "début de l'adhésion"
#: models.py:80
msgid "How long after January 1st the members can renew their membership."
msgstr ""
#: models.py:84
msgid "membership end"
msgstr "fin de l'adhésion"
#: models.py:85
msgid ""
"How long the membership can last after January 1st of the next year after "
"members can renew their membership."
msgstr ""
#: models.py:95
msgid "name"
msgstr "nom"
#: models.py:100
msgid "role"
msgstr "rôle"
#: models.py:101
msgid "roles"
msgstr "rôles"
#: models.py:118
msgid "membership starts on"
msgstr "l'adhésion commence le"
#: models.py:121
#, fuzzy
#| msgid "membership fees"
msgid "membership ends on"
msgstr "l'adhésion finie le"
#: models.py:125
msgid "fee"
msgstr "cotisation"
#: models.py:129
msgid "membership"
msgstr "adhésion"
#: models.py:130
msgid "memberships"
msgstr "adhésions"
# Generated by Django 2.2.3 on 2019-07-16 07:17
# Generated by Django 2.2.3 on 2019-07-16 10:33
from django.conf import settings
from django.db import migrations, models
......@@ -14,18 +14,38 @@ class Migration(migrations.Migration):
]
operations = [
migrations.CreateModel(
name='Club',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='paid')),
('email', models.EmailField(max_length=254, verbose_name='email')),
('membership_fee', models.PositiveIntegerField(verbose_name='membership fee')),
('membership_duration', models.DurationField(help_text='The longest time a membership can last (NULL = infinite).', null=True, verbose_name='membership duration')),
('membership_start', models.DurationField(help_text='How long after January 1st the members can renew their membership.', null=True, verbose_name='membership start')),
('membership_end', models.DurationField(help_text='How long the membership can last after January 1st of the next year after members can renew their membership.', null=True, verbose_name='membership end')),
],
),
migrations.CreateModel(
name='Role',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='name')),
],
options={
'verbose_name': 'role',
'verbose_name_plural': 'roles',
},
),
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('avatar', models.ImageField(blank=True, max_length=255, upload_to='', verbose_name='profile picture')),
('profile_picture', models.ImageField(blank=True, max_length=255, upload_to='', verbose_name='profile picture')),
('phone_number', models.CharField(blank=True, default='', max_length=50, null=True, verbose_name='phone number')),
('section', models.CharField(help_text='e.g. "1A0", "9A♥", "SAPHIRE"', max_length=255, verbose_name='section')),
('genre', models.CharField(blank=True, choices=[(None, 'ND'), ('M', 'M'), ('F', 'F')], max_length=1, null=True)),
('address', models.TextField(blank=True, null=True)),
('address', models.CharField(blank=True, max_length=255, null=True, verbose_name='address')),
('paid', models.BooleanField(default=False, verbose_name='paid')),
('is_active', models.BooleanField(default=True, verbose_name='is active')),
('is_deleted', models.BooleanField(default=False, verbose_name='is deleted')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
......@@ -34,16 +54,19 @@ class Migration(migrations.Migration):
},
),
migrations.CreateModel(
name='MembershipFee',
name='Membership',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateField(max_length=255, verbose_name='date')),
('amount', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='amount')),
('date_start', models.DateField(verbose_name='membership starts on')),
('date_end', models.DateField(null=True, verbose_name='membership ends on')),
('fee', models.PositiveIntegerField(verbose_name='fee')),
('club', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='member.Club')),
('roles', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='member.Role')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'membership fee',
'verbose_name_plural': 'membership fees',
'verbose_name': 'membership',
'verbose_name_plural': 'memberships',
},
),
]
......@@ -3,7 +3,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
......@@ -17,40 +16,30 @@ class Profile(models.Model):
We do not want to patch the Django Contrib Auth User class
so this model add an user profile with additional information.
"""
GENRES = [
(None, "ND"),
("M", "M"),
("F", "F"),
]
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
avatar = models.ImageField(
profile_picture = models.ImageField(
verbose_name=_('profile picture'),
max_length=255,
blank=True,
verbose_name=_('profile picture'),
)
phone_number = models.CharField(
verbose_name=_('phone number'),
max_length=50,
blank=True,
null=True,
default='',
verbose_name=_('phone number'),
)
section = models.CharField(
max_length=255,
verbose_name=_('section'),
help_text=_('e.g. "1A0", "9A♥", "SAPHIRE"'),
max_length=255,
)
genre = models.CharField(
max_length=1,
blank=True,
null=True,
choices=GENRES,
)
address = models.TextField(
address = models.CharField(
verbose_name=_('address'),
max_length=255,
blank=True,
null=True,
)
......@@ -58,44 +47,90 @@ class Profile(models.Model):
verbose_name=_("paid"),
default=False,
)
is_active = models.BooleanField(
verbose_name=_("is active"),
default=True,
)
is_deleted = models.BooleanField(
verbose_name=_("is deleted"),
default=False,
)
class Meta:
verbose_name = _('user profile')
verbose_name_plural = _('user profile')
class MembershipFee(models.Model):
class Club(models.Model):
"""
A student club
"""
name = models.CharField(
verbose_name=_('paid'),
max_length=255,
)
email = models.EmailField(
verbose_name=_('email'),
)
# Memberships
membership_fee = models.PositiveIntegerField(
verbose_name=_('membership fee'),
)
membership_duration = models.DurationField(
null=True,
verbose_name=_('membership duration'),
help_text=_('The longest time a membership can last (NULL = infinite).'),
)
membership_start = models.DurationField(
null=True,
verbose_name=_('membership start'),
help_text=_('How long after January 1st the members can renew their membership.'),
)
membership_end = models.DurationField(
null=True,
verbose_name=_('membership end'),
help_text=_('How long the membership can last after January 1st of the next year '
'after members can renew their membership.'),
)
class Role(models.Model):
"""
User can become member by paying a membership fee
Role that an user can have in a club
"""
name = models.CharField(
verbose_name=_('name'),
max_length=255,
)
class Meta:
verbose_name = _('role')
verbose_name_plural = _('roles')
class Membership(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.PROTECT,
on_delete=models.PROTECT
)
date = models.DateField(
max_length=255,
verbose_name=_('date'),
club = models.ForeignKey(
Club,
on_delete=models.PROTECT
)
roles = models.ForeignKey(
Role,
on_delete=models.PROTECT
)
date_start = models.DateField(
verbose_name=_('membership starts on'),
)
date_end = models.DateField(
verbose_name=_('membership ends on'),
null=True,
)
amount = models.DecimalField(
max_digits=5, # Max 999.99 €
decimal_places=2,
verbose_name=_('amount'),
fee = models.PositiveIntegerField(
verbose_name=_('fee'),
)
class Meta:
verbose_name = _('membership fee')
verbose_name_plural = _('membership fees')
verbose_name = _('membership')
verbose_name_plural = _('memberships')
@receiver(post_save, sender=User)
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def save_user_profile(instance, created, **_kwargs):
"""
Hook to save an user profile when an user is updated
......