From 1ba104c1466be680aa07e8fc9b141f41e27cb086 Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Mon, 26 Feb 2024 10:47:40 +0100 Subject: [PATCH] change field to DecimalField --- ...ticevent_price.py => 0050_alter_touristicevent_price.py} | 6 +++--- geotrek/tourism/models.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) rename geotrek/tourism/migrations/{0050_touristicevent_price.py => 0050_alter_touristicevent_price.py} (52%) diff --git a/geotrek/tourism/migrations/0050_touristicevent_price.py b/geotrek/tourism/migrations/0050_alter_touristicevent_price.py similarity index 52% rename from geotrek/tourism/migrations/0050_touristicevent_price.py rename to geotrek/tourism/migrations/0050_alter_touristicevent_price.py index df51f4be01..f764672c1b 100644 --- a/geotrek/tourism/migrations/0050_touristicevent_price.py +++ b/geotrek/tourism/migrations/0050_alter_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 09:45 import django.core.validators from django.db import migrations, models @@ -11,9 +11,9 @@ class Migration(migrations.Migration): ] operations = [ - migrations.AddField( + migrations.AlterField( 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)]