diff --git a/.gitignore b/.gitignore index 91e55e22..40e0824d 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ map.json backups/ /static/ /media/ +/tmp/ # Virtualenv env/ diff --git a/apps/activity/fixtures/initial.json b/apps/activity/fixtures/initial.json index 63c5009e..7961c17f 100644 --- a/apps/activity/fixtures/initial.json +++ b/apps/activity/fixtures/initial.json @@ -6,7 +6,7 @@ "name": "Pot", "manage_entries": true, "can_invite": true, - "guest_entry_fee": 500 + "guest_entry_fee": 1000 } }, { @@ -28,5 +28,25 @@ "can_invite": false, "guest_entry_fee": 0 } + }, + { + "model": "activity.activitytype", + "pk": 5, + "fields": { + "name": "Soir\u00e9e avec entrées", + "manage_entries": true, + "can_invite": false, + "guest_entry_fee": 0 + } + }, + { + "model": "activity.activitytype", + "pk": 7, + "fields": { + "name": "Soir\u00e9e avec invitations", + "manage_entries": true, + "can_invite": true, + "guest_entry_fee": 0 + } } ] diff --git a/apps/api/pagination.py b/apps/api/pagination.py index d897b583..1c6b1a1f 100644 --- a/apps/api/pagination.py +++ b/apps/api/pagination.py @@ -1,5 +1,5 @@ from rest_framework.pagination import PageNumberPagination + class CustomPagination(PageNumberPagination): page_size_query_param = 'page_size' - diff --git a/apps/member/forms.py b/apps/member/forms.py index ab24ded6..527816cb 100644 --- a/apps/member/forms.py +++ b/apps/member/forms.py @@ -47,6 +47,13 @@ class ProfileForm(forms.ModelForm): last_report = forms.DateTimeField(required=False, disabled=True, label=_("Last report date")) + VSS_charter_read = forms.BooleanField( + required=True, + label=_("Anti-VSS (Violences Sexistes et Sexuelles) charter read and approved"), + help_text=_("Tick after having read and accepted the anti-VSS charter \ + available here in pdf") + ) + def clean_promotion(self): promotion = self.cleaned_data["promotion"] if promotion > timezone.now().year: diff --git a/apps/member/migrations/0009_auto_20220904_2325.py b/apps/member/migrations/0009_auto_20220904_2325.py new file mode 100644 index 00000000..e259dacf --- /dev/null +++ b/apps/member/migrations/0009_auto_20220904_2325.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.26 on 2022-09-04 21:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('member', '0008_auto_20211005_1544'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='promotion', + field=models.PositiveSmallIntegerField(default=2022, help_text='Year of entry to the school (None if not ENS student)', null=True, verbose_name='promotion'), + ), + ] diff --git a/apps/member/migrations/0010_new_default_year.py b/apps/member/migrations/0010_new_default_year.py new file mode 100644 index 00000000..90740c57 --- /dev/null +++ b/apps/member/migrations/0010_new_default_year.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.28 on 2023-08-23 21:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('member', '0009_auto_20220904_2325'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='promotion', + field=models.PositiveSmallIntegerField(default=2023, help_text='Year of entry to the school (None if not ENS student)', null=True, verbose_name='promotion'), + ), + ] diff --git a/apps/member/migrations/0011_profile_vss_charter_read.py b/apps/member/migrations/0011_profile_vss_charter_read.py new file mode 100644 index 00000000..502cc6e0 --- /dev/null +++ b/apps/member/migrations/0011_profile_vss_charter_read.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.28 on 2023-08-31 09:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('member', '0010_new_default_year'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='VSS_charter_read', + field=models.BooleanField(default=False, verbose_name='VSS charter read'), + ), + ] diff --git a/apps/member/models.py b/apps/member/models.py index 0b471f12..5e0da5bc 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -134,6 +134,11 @@ class Profile(models.Model): default=False, ) + VSS_charter_read = models.BooleanField( + verbose_name=_("VSS charter read"), + default=False + ) + @property def ens_year(self): """ @@ -263,7 +268,7 @@ class Club(models.Model): today = datetime.date.today() - if (today - self.membership_start).days >= 365: + while (today - self.membership_start).days >= 365: if self.membership_start: self.membership_start = datetime.date(self.membership_start.year + 1, self.membership_start.month, self.membership_start.day) diff --git a/apps/member/static/member/js/trust.js b/apps/member/static/member/js/trust.js index a16bed08..15b5359f 100644 --- a/apps/member/static/member/js/trust.js +++ b/apps/member/static/member/js/trust.js @@ -1,7 +1,7 @@ /** * On form submit, create a new friendship */ -function create_trust (e) { +function form_create_trust (e) { // Do not submit HTML form e.preventDefault() @@ -14,25 +14,35 @@ function create_trust (e) { addMsg(gettext("You can't add yourself as a friend"), "danger") return } - $.post('/api/note/trust/', { - csrfmiddlewaretoken: formData.get('csrfmiddlewaretoken'), - trusting: formData.get('trusting'), - trusted: trusted_alias.note - }).done(function () { - // Reload table - $('#trust_table').load(location.pathname + ' #trust_table') - addMsg(gettext('Friendship successfully added'), 'success') - }).fail(function (xhr, _textStatus, _error) { - errMsg(xhr.responseJSON) - }) + create_trust(formData.get('trusting'), trusted_alias.note) }).fail(function (xhr, _textStatus, _error) { errMsg(xhr.responseJSON) }) } /** - * On click of "delete", delete the alias - * @param button_id:Integer Alias id to remove + * Create a trust between users + * @param trusting:Integer trusting note id + * @param trusted:Integer trusted note id + */ +function create_trust(trusting, trusted) { + $.post('/api/note/trust/', { + trusting: trusting, + trusted: trusted, + csrfmiddlewaretoken: CSRF_TOKEN + }).done(function () { + // Reload tables + $('#trust_table').load(location.pathname + ' #trust_table') + $('#trusted_table').load(location.pathname + ' #trusted_table') + addMsg(gettext('Friendship successfully added'), 'success') + }).fail(function (xhr, _textStatus, _error) { + errMsg(xhr.responseJSON) + }) +} + +/** + * On click of "delete", delete the trust + * @param button_id:Integer Trust id to remove */ function delete_button (button_id) { $.ajax({ @@ -42,6 +52,7 @@ function delete_button (button_id) { }).done(function () { addMsg(gettext('Friendship successfully deleted'), 'success') $('#trust_table').load(location.pathname + ' #trust_table') + $('#trusted_table').load(location.pathname + ' #trusted_table') }).fail(function (xhr, _textStatus, _error) { errMsg(xhr.responseJSON) }) @@ -49,5 +60,5 @@ function delete_button (button_id) { $(document).ready(function () { // Attach event - document.getElementById('form_trust').addEventListener('submit', create_trust) + document.getElementById('form_trust').addEventListener('submit', form_create_trust) }) diff --git a/apps/member/templates/member/profile_trust.html b/apps/member/templates/member/profile_trust.html index bd8d6b50..b89f05f6 100644 --- a/apps/member/templates/member/profile_trust.html +++ b/apps/member/templates/member/profile_trust.html @@ -7,7 +7,7 @@ SPDX-License-Identifier: GPL-3.0-or-later {% block profile_content %}