Remove foreign key dependency range <-> rangeonlineinfo

This commit is contained in:
app@gmba.django-hosting.ch 2021-11-30 09:13:55 +01:00
parent 1960abdbcb
commit 8020fa955e
4 changed files with 42 additions and 8 deletions

View file

@ -0,0 +1,19 @@
# Generated by Django 3.2.5 on 2021-11-30 08:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0047_alter_mountainrange_area'),
]
operations = [
migrations.AlterField(
model_name='rangeonlineinfo',
name='range_name',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='app.mountainrange', to_field='range_name_map'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 3.2.5 on 2021-11-30 08:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0048_alter_rangeonlineinfo_range_name'),
]
operations = [
migrations.AlterField(
model_name='rangeonlineinfo',
name='range_name',
field=models.TextField(blank=True, null=True),
),
]

View file

@ -1,4 +1,4 @@
# Generated by Django 3.2.5 on 2021-11-29 04:12
# Generated by Django 3.2.5 on 2021-11-30 08:09
from django.db import migrations, models
@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0047_alter_mountainrange_area'),
('app', '0049_alter_rangeonlineinfo_range_name'),
]
operations = [
@ -15,9 +15,4 @@ class Migration(migrations.Migration):
name='range_name_map',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='rangeonlineinfo',
name='range_name',
field=models.TextField(blank=True, null=True),
),
]

View file

@ -89,6 +89,7 @@ class MountainRange(models.Model):
countries = models.TextField(blank=True, null=True)
range_name_map = models.CharField(blank=True, null=True, max_length=128)
#range_name_map = models.CharField(blank=True, null=True, unique=True, max_length=128)
range_name = models.CharField(blank=True, null=True, max_length=128)
range_name_ascii = models.CharField(blank=True, null=True, max_length=128)
range_name_language = models.ForeignKey(Language, models.DO_NOTHING, blank=True, null=True, to_field='id')
@ -428,7 +429,8 @@ class RangeOnlineInfo(models.Model):
id = models.AutoField(primary_key=True)
# This is supposed to be linked to MountainRange via range_name_map, but the range_name_map
# is not itself unique. Are we missing something? TODO: Investigate
# range_name = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True, to_field='range_name_map')
#range_name = models.ForeignKey(MountainRange, models.DO_NOTHING, blank=True, null=True, to_field='range_name_map')
#range_name = models.ForeignKey(MountainRange, blank=True, null=True, to_field='range_name_map', on_delete=models.CASCADE)
range_name = models.TextField(blank=True, null=True)
info_source = models.TextField(blank=True, null=True)
url = models.TextField(blank=True, null=True)