From ec60c09eeb43b9a1af205e39a3f316b09ad19c19 Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Mon, 26 Feb 2024 10:47:40 +0100 Subject: [PATCH] change field to DecimalField --- geotrek/tourism/migrations/0050_touristicevent_price.py | 4 ++-- geotrek/tourism/models.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/geotrek/tourism/migrations/0050_touristicevent_price.py b/geotrek/tourism/migrations/0050_touristicevent_price.py index df51f4be01..e61e394540 100644 --- a/geotrek/tourism/migrations/0050_touristicevent_price.py +++ b/geotrek/tourism/migrations/0050_touristicevent_price.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.23 on 2023-12-13 12:42 +# Generated by Django 3.2.23 on 2024-02-26 11:06 import django.core.validators from django.db import migrations, models @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='touristicevent', name='price', - field=models.FloatField(blank=True, help_text='0 mean free', null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Price'), + field=models.DecimalField(blank=True, decimal_places=2, help_text='0 mean free', max_digits=8, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Price'), ), ] diff --git a/geotrek/tourism/models.py b/geotrek/tourism/models.py index 72fdb988d1..a5e0b71e4b 100644 --- a/geotrek/tourism/models.py +++ b/geotrek/tourism/models.py @@ -458,9 +458,11 @@ class TouristicEvent(ZoningPropertiesMixin, AddPropertyMixin, PublishableMixin, help_text=_("In hours (1.5 = 1 h 30, 24 = 1 day, 48 = 2 days)"), validators=[MinValueValidator(0)] ) - price = models.FloatField( + price = models.DecimalField( null=True, blank=True, + max_digits=8, + decimal_places=2, verbose_name=_("Price"), help_text=_("0 mean free"), validators=[MinValueValidator(0)]