mirror of
https://github.com/ae-utbm/sith.git
synced 2025-10-14 08:48:30 +00:00
Compare commits
5 Commits
subscripti
...
update_sub
Author | SHA1 | Date | |
---|---|---|---|
|
2550fd0af7 | ||
|
4b44e50780 | ||
|
40c3276c3c | ||
|
543a424258 | ||
|
8ff25e6034 |
@@ -76,18 +76,20 @@
|
||||
It will stay hidden for other users until it has been published.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
{% if user.has_perm("com.moderate_news") %}
|
||||
{%- if user.has_perm("com.moderate_news") -%}
|
||||
{# This is an additional query for each non-moderated news,
|
||||
but it will be executed only for admin users, and only one time
|
||||
(if they do their job and moderated news as soon as they see them),
|
||||
(if they do their job and moderate news as soon as they see them),
|
||||
so it's still reasonable #}
|
||||
<div
|
||||
{% if news is integer or news is string %}
|
||||
{% if news is integer or news is string -%}
|
||||
x-data="{ nbEvents: 0 }"
|
||||
x-init="nbEvents = await nbToPublish()"
|
||||
{% else %}
|
||||
{%- elif news.is_published -%}
|
||||
x-data="{ nbEvents: 0 }"
|
||||
{%- else -%}
|
||||
x-data="{ nbEvents: {{ news.dates.count() }} }"
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
>
|
||||
<template x-if="nbEvents > 1">
|
||||
<div>
|
||||
|
@@ -77,22 +77,22 @@
|
||||
<div class="notification" x-data="{display: false}" :class="{white: display}">
|
||||
<a href="#" @click.prevent="display = !display">
|
||||
<i :class="`fa-${display ? 'solid': 'regular'} fa-bell`" x-transition></i>
|
||||
{% set notification_count = user.notifications.filter(viewed=False).count() %}
|
||||
{% set notifications = user.notifications.filter(viewed=False).order_by("-date")|list %}
|
||||
|
||||
{% if notification_count > 0 %}
|
||||
{%- if notifications|length > 0 -%}
|
||||
<span>
|
||||
{% if notification_count < 100 %}
|
||||
{{ notification_count }}
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
{% if notifications|length < 100 %}
|
||||
{{ notifications|length }}
|
||||
{%- else -%}
|
||||
99+
|
||||
{%- endif -%}
|
||||
</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
<div id="header_notif" x-show="display" x-cloak x-transition @click.outside="display = false">
|
||||
<ul>
|
||||
{% if user.notifications.filter(viewed=False).count() > 0 %}
|
||||
{% for n in user.notifications.filter(viewed=False).order_by('-date') %}
|
||||
{%- if notifications|length > 0 -%}
|
||||
{%- for n in notifications -%}
|
||||
<li>
|
||||
<a href="{{ url("core:notification", notif_id=n.id) }}">
|
||||
<div class="datetime">
|
||||
@@ -108,10 +108,10 @@
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{%- endfor -%}
|
||||
{%- else -%}
|
||||
<li class="empty-notification">{% trans %}You do not have any unread notification{% endtrans %}</li>
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
<div class="options">
|
||||
<a href="{{ url('core:notification_list') }}">
|
||||
|
@@ -1,3 +1,4 @@
|
||||
{% spaceless %}
|
||||
{% for js in statics.js %}
|
||||
<script-once type="module" src="{{ js }}"></script-once>
|
||||
{% endfor %}
|
||||
@@ -21,3 +22,4 @@
|
||||
<slot style="display:none" name="initial">{{ initial }}</slot>
|
||||
{% endif %}
|
||||
</{{ component }}>
|
||||
{% endspaceless %}
|
@@ -67,13 +67,13 @@
|
||||
<option value="FIN">{% trans %}Confirm (FIN){% endtrans %}</option>
|
||||
<option value="ANN">{% trans %}Cancel (ANN){% endtrans %}</option>
|
||||
</optgroup>
|
||||
{% for category in categories.keys() %}
|
||||
{%- for category in categories.keys() -%}
|
||||
<optgroup label="{{ category }}">
|
||||
{% for product in categories[category] %}
|
||||
{%- for product in categories[category] -%}
|
||||
<option value="{{ product.id }}">{{ product }}</option>
|
||||
{% endfor %}
|
||||
{%- endfor -%}
|
||||
</optgroup>
|
||||
{% endfor %}
|
||||
{%- endfor -%}
|
||||
</counter-product-select>
|
||||
|
||||
<input type="submit" value="{% trans %}Go{% endtrans %}"/>
|
||||
|
@@ -4974,47 +4974,47 @@ msgstr "Suppression de rechargement"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "One semester"
|
||||
msgstr "Un semestre, 20 €"
|
||||
msgstr "Un semestre"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Two semesters"
|
||||
msgstr "Deux semestres, 35 €"
|
||||
msgstr "Deux semestres"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Common core cursus"
|
||||
msgstr "Cursus tronc commun, 60 €"
|
||||
msgstr "Cursus tronc commun"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Branch cursus"
|
||||
msgstr "Cursus branche, 60 €"
|
||||
msgstr "Cursus branche"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Alternating cursus"
|
||||
msgstr "Cursus alternant, 30 €"
|
||||
msgstr "Cursus alternant"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Honorary member"
|
||||
msgstr "Membre honoraire, 0 €"
|
||||
msgstr "Membre honoraire"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Assidu member"
|
||||
msgstr "Membre d'Assidu, 0 €"
|
||||
msgstr "Membre d'Assidu"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Amicale/DOCEO member"
|
||||
msgstr "Membre de l'Amicale/DOCEO, 0 €"
|
||||
msgstr "Membre de l'Amicale/DOCEO"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "UT network member"
|
||||
msgstr "Cotisant du réseau UT, 0 €"
|
||||
msgstr "Cotisant du réseau UT"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "CROUS member"
|
||||
msgstr "Membres du CROUS, 0 €"
|
||||
msgstr "Membres du CROUS"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Sbarro/ESTA member"
|
||||
msgstr "Membre de Sbarro ou de l'ESTA, 20 €"
|
||||
msgstr "Membre de Sbarro ou de l'ESTA"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "One semester Welcome Week"
|
||||
@@ -5041,28 +5041,28 @@ msgid "One day"
|
||||
msgstr "Un jour"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "GA staff member"
|
||||
msgstr "Membre staff GA (2 semaines), 1 €"
|
||||
msgid "GA staff member (2 weeks)"
|
||||
msgstr "Membre staff GA (2 semaines)"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "One semester (-20%)"
|
||||
msgstr "Un semestre (-20%), 12 €"
|
||||
msgstr "Un semestre (-20%)"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Two semesters (-20%)"
|
||||
msgstr "Deux semestres (-20%), 22 €"
|
||||
msgstr "Deux semestres (-20%)"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Common core cursus (-20%)"
|
||||
msgstr "Cursus tronc commun (-20%), 36 €"
|
||||
msgstr "Cursus tronc commun (-20%)"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Branch cursus (-20%)"
|
||||
msgstr "Cursus branche (-20%), 36 €"
|
||||
msgstr "Cursus branche (-20%)"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "Alternating cursus (-20%)"
|
||||
msgstr "Cursus alternant (-20%), 24 €"
|
||||
msgstr "Cursus alternant (-20%)"
|
||||
|
||||
#: sith/settings.py
|
||||
msgid "One year for free(CA offer)"
|
||||
|
@@ -541,7 +541,7 @@ SITH_SUBSCRIPTIONS = {
|
||||
"duration": 4,
|
||||
},
|
||||
"cursus-branche": {"name": _("Branch cursus"), "price": 60, "duration": 6},
|
||||
"cursus-alternant": {"name": _("Alternating cursus"), "price": 30, "duration": 6},
|
||||
"cursus-alternant": {"name": _("Alternating cursus"), "price": 35, "duration": 6},
|
||||
"membre-honoraire": {"name": _("Honorary member"), "price": 0, "duration": 666},
|
||||
"assidu": {"name": _("Assidu member"), "price": 0, "duration": 2},
|
||||
"amicale/doceo": {"name": _("Amicale/DOCEO member"), "price": 0, "duration": 2},
|
||||
@@ -553,8 +553,6 @@ SITH_SUBSCRIPTIONS = {
|
||||
"price": 0,
|
||||
"duration": 1,
|
||||
},
|
||||
"un-mois-essai": {"name": _("One month for free"), "price": 0, "duration": 0.166},
|
||||
"deux-mois-essai": {"name": _("Two months for free"), "price": 0, "duration": 0.33},
|
||||
"benevoles-euroks": {"name": _("Eurok's volunteer"), "price": 5, "duration": 0.1},
|
||||
"six-semaines-essai": {
|
||||
"name": _("Six weeks for free"),
|
||||
|
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.2.3 on 2025-10-06 11:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import subscription.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("subscription", "0015_alter_subscription_location_and_more")]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="subscription",
|
||||
name="subscription_type",
|
||||
field=models.CharField(
|
||||
choices=subscription.models.get_subscription_types,
|
||||
max_length=255,
|
||||
verbose_name="subscription type",
|
||||
),
|
||||
)
|
||||
]
|
@@ -38,16 +38,19 @@ def validate_payment(value):
|
||||
raise ValidationError(_("Bad payment method"))
|
||||
|
||||
|
||||
def get_subscription_types():
|
||||
return (
|
||||
(k, f"{v['name']}, {v['price']}€")
|
||||
for k, v in sorted(settings.SITH_SUBSCRIPTIONS.items())
|
||||
)
|
||||
|
||||
|
||||
class Subscription(models.Model):
|
||||
member = models.ForeignKey(
|
||||
User, related_name="subscriptions", on_delete=models.CASCADE
|
||||
)
|
||||
subscription_type = models.CharField(
|
||||
_("subscription type"),
|
||||
max_length=255,
|
||||
choices=(
|
||||
(k, v["name"]) for k, v in sorted(settings.SITH_SUBSCRIPTIONS.items())
|
||||
),
|
||||
_("subscription type"), max_length=255, choices=get_subscription_types
|
||||
)
|
||||
subscription_start = models.DateField(_("subscription start"))
|
||||
subscription_end = models.DateField(_("subscription end"))
|
||||
|
Reference in New Issue
Block a user