# Migration list 975->288

* adds migration for app codelist to migrate existing biotope type details codes from list 975 to 288 depending on their atomID
* improves rendering of action and biotope type details on frontend for KOM, OEK and EMA
* refactors KonovaCode str() rendering
This commit is contained in:
2024-08-07 09:12:38 +02:00
parent 94e9035e10
commit df241747cf
12 changed files with 69 additions and 14 deletions

View File

@@ -25,13 +25,11 @@ class KonovaCode(models.Model):
)
short_name = models.CharField(
max_length=500,
null=True,
blank=True,
help_text="Short version of long name",
)
long_name = models.CharField(
max_length=1000,
null=True,
blank=True,
help_text="",
)
@@ -54,12 +52,17 @@ class KonovaCode(models.Model):
long_name = self.long_name
short_name = self.short_name
both_names_exist = long_name and short_name
both_names_exist = long_name is not None and short_name is not None
if both_names_exist:
if with_parent:
if self.parent and self.parent.long_name:
if with_parent and self.parent:
parent_short_name_exists = self.parent.short_name is not None
parent_long_name_exists = self.parent.long_name is not None
if parent_long_name_exists:
ret_val += self.parent.long_name + " > "
elif parent_short_name_exists:
ret_val += self.parent.short_name + " > "
ret_val += long_name
if short_name and short_name != long_name: