diff --git a/backend/server/worldtravel/models.py b/backend/server/worldtravel/models.py index ea639288..8f4aca07 100644 --- a/backend/server/worldtravel/models.py +++ b/backend/server/worldtravel/models.py @@ -45,7 +45,7 @@ def __str__(self): class Region(models.Model): id = models.CharField(primary_key=True) name = models.CharField(max_length=100) - name_en = models.CharField(max_length=100) + name_en = models.CharField(max_length=100, blank=True, null=True) country = models.ForeignKey(Country, on_delete=models.CASCADE) def __str__(self): diff --git a/frontend/src/lib/components/RegionCard.svelte b/frontend/src/lib/components/RegionCard.svelte index e68b0478..1b5ceea5 100644 --- a/frontend/src/lib/components/RegionCard.svelte +++ b/frontend/src/lib/components/RegionCard.svelte @@ -57,10 +57,10 @@ class="card w-full max-w-xs sm:max-w-sm md:max-w-md lg:max-w-md xl:max-w-md bg-primary-content shadow-xl overflow-hidden text-base-content" >
- {#if region.name == region.name_en} -

{region.name}

- {:else} + {#if region.name !== region?.name_en}

{region.name} ({region.name_en})

+ {:else} +

{region.name}

{/if}

{region.id}

diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts index b04ba9c1..4a7bdde5 100644 --- a/frontend/src/lib/types.ts +++ b/frontend/src/lib/types.ts @@ -44,7 +44,7 @@ export type Country = { export type Region = { id: number; name: string; - name_en: string; + name_en?: string; country: number; };