Attempt to link Range and RangeType models

This commit is contained in:
PCoder 2021-11-26 13:00:23 +05:30
parent 11131922ab
commit 993990a7cb
2 changed files with 28 additions and 9 deletions

View file

@ -0,0 +1,19 @@
# Generated by Django 3.2.5 on 2021-11-26 07:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0022_alter_organization_country'),
]
operations = [
migrations.AlterField(
model_name='range',
name='feature',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='app.rangetype'),
),
]

View file

@ -68,6 +68,14 @@ class Language(models.Model):
return self.language
class RangeType(models.Model):
id = models.AutoField(primary_key=True)
range_type = models.TextField(blank=True, null=True)
def __str__(self):
return self.range_type
class Range(models.Model):
id = models.AutoField(primary_key=True)
source_id = models.IntegerField(blank=True, null=True)
@ -80,7 +88,7 @@ class Range(models.Model):
range_name_ascii = models.TextField(blank=True, null=True)
range_name_language = models.ForeignKey(Language, models.DO_NOTHING, blank=True, null=True, to_field='id')
mother_range = models.ForeignKey("self", models.DO_NOTHING, blank=True, null=True, to_field='id')
feature = models.TextField(blank=True, null=True) # TODO needs to be a drop down
feature = models.ForeignKey(RangeType, models.DO_NOTHING, blank=True, null=True, to_field='id')
map_unit = models.TextField(blank=True, null=True)
level = models.TextField(blank=True, null=True)
level_text = models.TextField(blank=True, null=True)
@ -237,14 +245,6 @@ class PeopleStatus(models.Model):
return self.status
class RangeType(models.Model):
id = models.AutoField(primary_key=True)
range_type = models.TextField(blank=True, null=True)
def __str__(self):
return self.range_type
class RedListCategory(models.Model):
id = models.AutoField(primary_key=True)
red_list_category = models.TextField(blank=True, null=True)