mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
26
people/migrations/0011_person_add_organisation.py
Normal file
26
people/migrations/0011_person_add_organisation.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# Generated by Django 2.2.10 on 2020-02-25 08:49
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('people', '0010_add_country_fields'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Organisation',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255)),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='person',
|
||||
name='organisation',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='members', to='people.Organisation'),
|
||||
),
|
||||
]
|
||||
@@ -17,6 +17,14 @@ class User(AbstractUser):
|
||||
"""
|
||||
|
||||
|
||||
class Organisation(models.Model):
|
||||
"""
|
||||
Organisation to which a :class:`Person` belongs.
|
||||
"""
|
||||
name = models.CharField(max_length=255,
|
||||
blank=False, null=False)
|
||||
|
||||
|
||||
class Person(models.Model):
|
||||
"""
|
||||
A person may be a member of the BRECcIA core team or an external stakeholder.
|
||||
@@ -76,6 +84,11 @@ class Person(models.Model):
|
||||
nationality = CountryField(blank=True, null=True)
|
||||
|
||||
country_of_residence = CountryField(blank=True, null=True)
|
||||
|
||||
organisation = models.ForeignKey(Organisation,
|
||||
on_delete=models.PROTECT,
|
||||
related_name='members',
|
||||
blank=True, null=True)
|
||||
|
||||
@property
|
||||
def relationships(self):
|
||||
|
||||
Reference in New Issue
Block a user