diff --git a/openrepairplatform/event/models.py b/openrepairplatform/event/models.py index c7e1e92a..c4bbf5b3 100644 --- a/openrepairplatform/event/models.py +++ b/openrepairplatform/event/models.py @@ -1,4 +1,5 @@ from datetime import date, datetime, timedelta +import locale from django.db import models from django.urls import reverse @@ -32,9 +33,12 @@ def get_absolute_url(self): kwargs={"orga_slug": self.organization.slug}, ) + def price_w_currency(self): + return locale.currency(self.price, grouping=True) + def __str__(self): if self.price > 0: - return f"{self.name} - {self.price}€" + return f"{self.name} - {self.price_w_currency}" return self.name @@ -42,6 +46,12 @@ class ActivityCategory(models.Model): name = models.CharField(verbose_name=_("Activity type"), max_length=100) slug = models.SlugField(blank=True) history = HistoricalRecords() + index = models.PositiveIntegerField(verbose_name='Order', + default=0, + editable=True, + help_text='Order in which the activity types will be displayed') + # The index field must be editable to enable adminsortable2 to work + # for enabling the elements always to be displayed in the right order, even if new ones def save(self, *args, **kwargs): self.slug = slugify(self.name) @@ -50,6 +60,8 @@ def save(self, *args, **kwargs): def __str__(self): return self.name + class Meta: + ordering = ['index', ] class Activity(models.Model): name = models.CharField(verbose_name=_("Activity type"), max_length=100) @@ -87,6 +99,8 @@ def get_absolute_url(self): def next_events(self): return get_future_published_events(self.events)[0:3] + class Meta: + verbose_name_plural = 'Activities' class Event(models.Model): WEEKS = [ diff --git a/openrepairplatform/event/templates/event/condition/list.html b/openrepairplatform/event/templates/event/condition/list.html index badb96f8..8d679406 100644 --- a/openrepairplatform/event/templates/event/condition/list.html +++ b/openrepairplatform/event/templates/event/condition/list.html @@ -6,7 +6,7 @@
{{ condition.name }}
{{ condition.description | safe }} {% if condition.price > 0 %} - {{ condition.price }}€ + {{ condition.price|currency }} {% else %} free {% endif %} diff --git a/openrepairplatform/event/templates/event/detail/event_detail_visitor.html b/openrepairplatform/event/templates/event/detail/event_detail_visitor.html index 98cf7a8c..c49e58c4 100644 --- a/openrepairplatform/event/templates/event/detail/event_detail_visitor.html +++ b/openrepairplatform/event/templates/event/detail/event_detail_visitor.html @@ -189,7 +189,7 @@
Informations utiles
  • {% if condition.price > 0 %} - {{ condition.price }}€ + {{ condition.price|currency }} {% else %} {% endif %} {{ condition.description | safe }} @@ -208,21 +208,21 @@
    Informations utiles
    statut {% if user_is_member.current_contribution == 0 %} Pas à jour - {{user_is_member.current_contribution}}€ + {{user_is_member.current_contribution|currency}} {% elif user_is_member.current_contribution >= organization.advised_fee %} A jour - {{user_is_member.current_contribution}}€ + {{user_is_member.current_contribution|currency}} {% else %} Incomplet - {{user_is_member.current_contribution}}€ + {{user_is_member.current_contribution|currency}} {% endif %} {% endif %}

    {{ event.organization.get_membership_system_display }} Elle {% if event.organization.advised_fee == event.organization.min_fee %} - est de {{event.organization.min_fee}}€ + est de {{event.organization.min_fee|currency}} {% else %} - va de {{event.organization.min_fee}}€ à {{event.organization.advised_fee}}€ + va de {{event.organization.min_fee|currency}} à {{event.organization.advised_fee|currency}} {% endif %} {% if event.organization.membership_url %} Vous pouvez @@ -303,7 +303,7 @@

    {% if condition.price > 0 %} - {{ condition.price }}€ + {{ condition.price|currency }} {% endif %} {{ condition.description | safe }}

  • @@ -339,21 +339,21 @@

    Pas à jour - {{user_is_member.current_contribution}}€ + {{user_is_member.current_contribution|currency}} {% elif user_is_member.current_contribution >= organization.advised_fee %} A jour - {{user_is_member.current_contribution}}€ + {{user_is_member.current_contribution|currency}} {% else %} Incomplet - {{user_is_member.current_contribution}}€ + {{user_is_member.current_contribution|currency}} {% endif %} {% endif %}

    {{ event.organization.get_membership_system_display }} Elle {% if event.organization.advised_fee == event.organization.min_fee %} - est de {{event.organization.min_fee}}€ + est de {{event.organization.min_fee|currency}} {% else %} - va de {{event.organization.min_fee}}€ à {{event.organization.advised_fee}}€ . + va de {{event.organization.min_fee|currency}} à {{event.organization.advised_fee|currency}} . {% endif %} {% if event.organization.membership_url %}
    diff --git a/openrepairplatform/event/templates/event/detail/registered_users.html b/openrepairplatform/event/templates/event/detail/registered_users.html index c0caaecf..cbaecd2f 100644 --- a/openrepairplatform/event/templates/event/detail/registered_users.html +++ b/openrepairplatform/event/templates/event/detail/registered_users.html @@ -43,13 +43,13 @@

    {{ user.email }}
    {% if membership %} {% if membership.current_contribution == 0 %} Pas de cotisation - 0€ + {{0|currency}} {% elif membership.current_contribution >= event.organization.advised_fee %} A jour - {{membership.current_contribution}}€/{{event.organization.advised_fee}}€ + {{membership.current_contribution|currency}}/{{event.organization.advised_fee|currency}} {% else %} Incomplet - {{membership.current_contribution}}€ + {{membership.current_contribution|currency}} {% endif %} {% else %} Non membre @@ -72,7 +72,7 @@
    {{ user.email }}
    {% if fees %} {% for fee in fees %} - {{ fee.amount }}€ + {{ fee.amount|currency }} {{ fee.get_payment_display }}
    {% csrf_token %} @@ -87,13 +87,13 @@
    {{ user.email }}

    Participation
    {% if participation.amount == 0 or not participation.amount %} - 0€ + {{0|currency}} {% elif participation.amount >= condition_prices %} - {{participation.amount}}€ + {{participation.amount|currency}} {% else %} - {{participation.amount}}€ + {{participation.amount|currency}} {% endif %} - / {{condition_prices }}€ + / {{condition_prices|currency }}

    {% if participation %}

    @@ -345,7 +345,7 @@ {% endif %} - {{ fee.amount }}€
    + {{ fee.amount|currency }}
    {{ fee.get_payment_display }}