Simplify role

This commit is contained in:
PCoder 2021-11-28 11:21:58 +05:30
parent bab37a767e
commit 208157f8c1
3 changed files with 39 additions and 11 deletions

View file

@ -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)

View file

@ -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',
),
]

View file

@ -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 ' -- '