diff --git a/app/admin.py b/app/admin.py index d4b8803..4c5a37f 100644 --- a/app/admin.py +++ b/app/admin.py @@ -354,4 +354,3 @@ admin.site.register(RangesPeople, PeopleRangeAdmin) admin.site.register(TaxonRange, TaxonRangeAdmin) admin.site.register(PeopleResource, PeopleResourceAdmin) admin.site.register(RangeCountry, RangeCountryAdmin) -admin.site.register(Role) diff --git a/app/migrations/0033_auto_20211128_0551.py b/app/migrations/0033_auto_20211128_0551.py new file mode 100644 index 0000000..9064da8 --- /dev/null +++ b/app/migrations/0033_auto_20211128_0551.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.5 on 2021-11-28 05:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0032_alter_person_search_name'), + ] + + operations = [ + migrations.RemoveField( + model_name='peopleresource', + name='p_r_role', + ), + migrations.AlterField( + model_name='peopleresource', + name='role', + field=models.TextField(blank=True, choices=[('', ''), ('Author', 'Author'), ('Chair', 'Chair'), ('Contributor', 'Contributor'), ('Coordinator', 'Coordinator'), ('Co - Chair', 'Co - Chair'), ('Editor', 'Editor'), ('Head', 'Head'), ('Member', 'Member'), ('Project partner', 'Project partner'), ('SSC', 'SSC')], null=True), + ), + migrations.DeleteModel( + name='Role', + ), + ] diff --git a/app/models.py b/app/models.py index 088abf7..d5a8f31 100644 --- a/app/models.py +++ b/app/models.py @@ -737,20 +737,24 @@ class TaxonRange(models.Model): return self.taxon if self.taxon else '--' -class Role(models.Model): - id = models.AutoField(primary_key=True) - role = models.TextField(blank=True, null=True) - - def __str__(self): - return self.role if self.role else '--' - - class PeopleResource(models.Model): + ROLES_CHOICES = ( + ('', ''), + ('Author', 'Author'), + ('Chair', 'Chair'), + ('Contributor', 'Contributor'), + ('Coordinator', 'Coordinator'), + ('Co - Chair', 'Co - Chair'), + ('Editor', 'Editor'), + ('Head', 'Head'), + ('Member', 'Member'), + ('Project partner', 'Project partner'), + ('SSC', 'SSC'), + ) id = models.AutoField(primary_key=True) person = models.ForeignKey(Person, models.DO_NOTHING, blank=True, null=True) resource = models.ForeignKey(Resource, models.DO_NOTHING, blank=True, null=True) - role = models.TextField(blank=True, null=True) - p_r_role = models.ForeignKey(Role, models.DO_NOTHING, blank=True, null=True) + role = models.TextField(blank=True, null=True, choices=ROLES_CHOICES) def __str__(self): return self.person.full_name if self.person else ' -- '