From 8e4904da34ac3e4c8914336ea7008ef70d9e1a67 Mon Sep 17 00:00:00 2001 From: Jukka Ahonen Date: Thu, 21 Nov 2024 14:06:15 +0000 Subject: [PATCH] tasotarkistus: renaming of model attributes --- ...emove_indexnumberyearly_number_and_more.py | 37 +++++++++++++++++++ leasing/models/rent.py | 14 +++---- leasing/serializers/rent.py | 4 +- locale/fi/LC_MESSAGES/django.po | 10 ++++- 4 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 leasing/migrations/0083_remove_indexnumberyearly_number_and_more.py diff --git a/leasing/migrations/0083_remove_indexnumberyearly_number_and_more.py b/leasing/migrations/0083_remove_indexnumberyearly_number_and_more.py new file mode 100644 index 00000000..6dd497fe --- /dev/null +++ b/leasing/migrations/0083_remove_indexnumberyearly_number_and_more.py @@ -0,0 +1,37 @@ +# Generated by Django 4.2.16 on 2024-11-21 13:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("leasing", "0082_rent_start_price_index"), + ] + + operations = [ + migrations.RemoveField( + model_name="indexnumberyearly", + name="number", + ), + migrations.AddField( + model_name="indexnumberyearly", + name="point_figure", + field=models.DecimalField( + decimal_places=1, + max_digits=8, + null=True, + verbose_name="Index point figure", + ), + ), + migrations.AlterField( + model_name="rent", + name="start_price_index", + field=models.DecimalField( + decimal_places=1, + max_digits=8, + null=True, + verbose_name="Start price index point figure", + ), + ), + ] diff --git a/leasing/models/rent.py b/leasing/models/rent.py index 50e424bf..c2ea0dcf 100644 --- a/leasing/models/rent.py +++ b/leasing/models/rent.py @@ -336,9 +336,9 @@ class Rent(TimeStampedSafeDeleteModel): null=True, ) - # In Finnish: Tasotarkistusindeksi vuokran alkaessa - start_price_index = models.DecimalField( - verbose_name=_("Index number"), + # In Finnish: Tasotarkistusindeksin pisteluku vuokran alkaessa (edellisen vuoden keskiarvo) + start_price_index_point_figure = models.DecimalField( + verbose_name=_("Start price index point figure"), decimal_places=1, max_digits=8, null=True, @@ -921,13 +921,13 @@ def is_active_on_period(self, date_range_start, date_range_end): return False - def set_start_price_index(self): + def set_start_price_index_point_figure(self): if self.old_dwellings_in_housing_companies_price_index: start_index_number_yearly = IndexNumberYearly.objects.get( index=self.old_dwellings_in_housing_companies_price_index, year=self.start_date.year - 1, ) - self.start_price_index = start_index_number_yearly.number + self.start_price_index_point_figure = start_index_number_yearly.point_figure class RentDueDate(TimeStampedSafeDeleteModel): @@ -1616,8 +1616,8 @@ class IndexNumberYearly(TimeStampedModel): # should be enough if the numbers are at most in the 100s of thousands. # Largest index number in the system at the moment is year 1914's index # with a number around 260 000. - number = models.DecimalField( - verbose_name=_("Index number"), + point_figure = models.DecimalField( + verbose_name=_("Index point figure"), decimal_places=1, max_digits=8, null=True, diff --git a/leasing/serializers/rent.py b/leasing/serializers/rent.py index 8b9a7010..67cb268d 100644 --- a/leasing/serializers/rent.py +++ b/leasing/serializers/rent.py @@ -51,14 +51,14 @@ class Meta: class IndexNumberYearlySerializer(serializers.Serializer): id = serializers.IntegerField(required=False) - number = serializers.DecimalField(max_digits=8, decimal_places=1) + point_figure = serializers.DecimalField(max_digits=8, decimal_places=1) year = serializers.IntegerField() region = serializers.CharField(max_length=255, required=False, allow_null=True) comment = serializers.CharField(required=False, allow_null=True) class Meta: model = IndexNumberYearly - fields = ("id", "number", "year", "region", "comment") + fields = ("id", "point_figure", "year", "region", "comment") class OldDwellingsInHousingCompaniesPriceIndexSerializer(serializers.ModelSerializer): diff --git a/locale/fi/LC_MESSAGES/django.po b/locale/fi/LC_MESSAGES/django.po index 3cb83e90..7e9e214e 100644 --- a/locale/fi/LC_MESSAGES/django.po +++ b/locale/fi/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: MVJ 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-30 14:47+0200\n" +"POT-Creation-Date: 2024-11-21 15:41+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: \n" "Language: fi\n" @@ -2576,6 +2576,12 @@ msgstr "" msgid "Override receivable type" msgstr "Korvaava saamislaji" +msgid "Old dwellings in housing companies price index" +msgstr "Vanhojen osakeasuntojen hintaindeksi" + +msgid "Start price index point figure" +msgstr "Tasotarkistusindeksin pisteluku vuokran alkaessa" + msgctxt "Model name" msgid "Rent" msgstr "Vuokra" @@ -2779,7 +2785,7 @@ msgctxt "model name" msgid "price indexes of old dwellings in housing companies" msgstr "Vanhojen osakeasuntojen hintaindeksit" -msgid "Index number" +msgid "Index point figure" msgstr "Indeksipisteluku" msgid "Comment"