Add LU models and model admin
This commit is contained in:
parent
78dd9d9354
commit
cfea61b5af
3 changed files with 227 additions and 0 deletions
59
app/admin.py
59
app/admin.py
|
@ -18,6 +18,51 @@ class FieldAdmin(admin.ModelAdmin):
|
|||
search_fields = ['name']
|
||||
|
||||
|
||||
class CountriesAdmin(admin.ModelAdmin):
|
||||
search_fields = ['short_name', 'formal_name', 'membership_within_un_system', 'continent', 'eu_ms', 'eea_ms', 'iso3',
|
||||
'iso2']
|
||||
|
||||
|
||||
class GMBA_SpeciesGroupAdmin(admin.ModelAdmin):
|
||||
search_fields = ['species_group']
|
||||
|
||||
|
||||
class LanguageAdmin(admin.ModelAdmin):
|
||||
search_fields = ['language']
|
||||
|
||||
|
||||
class PeopleStatusAdmin(admin.ModelAdmin):
|
||||
search_fields = ['status']
|
||||
|
||||
|
||||
class RangeTypeAdmin(admin.ModelAdmin):
|
||||
search_fields = ['range_type']
|
||||
|
||||
|
||||
class RedListCategoryAdmin(admin.ModelAdmin):
|
||||
search_fields = ['red_list_category']
|
||||
|
||||
|
||||
class SourceAdmin(admin.ModelAdmin):
|
||||
search_fields = ['source']
|
||||
|
||||
|
||||
class TaxonStatusAdmin(admin.ModelAdmin):
|
||||
search_fields = ['taxon_status']
|
||||
|
||||
|
||||
class TaxonUnitAdmin(admin.ModelAdmin):
|
||||
search_fields = ['taxon_status']
|
||||
|
||||
|
||||
class TrendsQuantityAdmin(admin.ModelAdmin):
|
||||
search_fields = ['trend']
|
||||
|
||||
|
||||
class TrendsQualityAdmin(admin.ModelAdmin):
|
||||
search_fields = ['trend']
|
||||
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Person, PersonAdmin)
|
||||
admin.site.register(Resource, ResourceAdmin)
|
||||
|
@ -26,3 +71,17 @@ admin.site.register(Method)
|
|||
admin.site.register(Scale)
|
||||
admin.site.register(Taxon)
|
||||
admin.site.register(Field, FieldAdmin)
|
||||
|
||||
|
||||
# LU models
|
||||
admin.site.register(Country, CountriesAdmin)
|
||||
admin.site.register(GMBA_SpeciesGroup, GMBA_SpeciesGroupAdmin)
|
||||
admin.site.register(Language, LanguageAdmin)
|
||||
admin.site.register(PeopleStatus, PeopleStatusAdmin)
|
||||
admin.site.register(RangeType, RangeTypeAdmin)
|
||||
admin.site.register(RedListCategory, RedListCategoryAdmin)
|
||||
admin.site.register(Source, SourceAdmin)
|
||||
admin.site.register(TaxonStatus, TaxonStatusAdmin)
|
||||
admin.site.register(TaxonUnit, TaxonUnitAdmin)
|
||||
admin.site.register(TrendsQuality, TrendsQualityAdmin)
|
||||
admin.site.register(TrendsQuantity, TrendsQuantityAdmin)
|
|
@ -0,0 +1,97 @@
|
|||
# Generated by Django 3.2.5 on 2021-10-29 02:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('app', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Country',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('short_name', models.TextField(blank=True, null=True)),
|
||||
('formal_name', models.TextField(blank=True, null=True)),
|
||||
('membership_within_un_system', models.TextField(blank=True, null=True)),
|
||||
('continent', models.TextField(blank=True, null=True)),
|
||||
('eu_ms', models.TextField(blank=True, null=True)),
|
||||
('eea_ms', models.TextField(blank=True, null=True)),
|
||||
('iso3', models.TextField(blank=True, null=True)),
|
||||
('iso2', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='GMBA_SpeciesGroup',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('species_group', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Language',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('language', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PeopleStatus',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('status', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='RangeType',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('range_type', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='RedListCategory',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('red_list_category', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Source',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('source', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TaxonStatus',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('taxon_status', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TaxonUnit',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('taxon_unit', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TrendsQuality',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('trend', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TrendsQuantity',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('trend', models.TextField(blank=True, null=True)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -206,3 +206,74 @@ class Taxon(models.Model):
|
|||
|
||||
def dict(self):
|
||||
return {'id': self.id, 'name': self.name}
|
||||
|
||||
|
||||
# LU models
|
||||
class Country(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
short_name = models.TextField(blank=True, null=True)
|
||||
formal_name = models.TextField(blank=True, null=True)
|
||||
membership_within_un_system = models.TextField(blank=True, null=True)
|
||||
continent = models.TextField(blank=True, null=True)
|
||||
eu_ms = models.TextField(blank=True, null=True)
|
||||
eea_ms = models.TextField(blank=True, null=True)
|
||||
iso3 = models.TextField(blank=True, null=True)
|
||||
iso2 = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.formal_name
|
||||
|
||||
|
||||
class GMBA_SpeciesGroup(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
species_group = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class Language(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
language = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class PeopleStatus(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
status = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class RangeType(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
range_type = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class RedListCategory(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
red_list_category = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class TaxonStatus(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
taxon_status = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class TaxonUnit(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
taxon_unit = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class TrendsQuality(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
trend = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class TrendsQuantity(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
trend = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class Language(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
language = models.TextField(blank=True, null=True)
|
||||
|
||||
|
||||
class Source(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
source = models.TextField(blank=True, null=True)
|
Loading…
Reference in a new issue