diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-02-17 21:28:52 +0000 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-02-17 21:28:52 +0000 |
commit | fae87b201cbecc6a74cc0c17800053d33cab0de4 (patch) | |
tree | 075ce78e195e9b7c9128d5f583df915750884107 /ctrack/organisations | |
parent | 7b6de8f88d2673ffdd61dc8cc7f1fca754c8cf88 (diff) |
added a lot of Person fields
Diffstat (limited to 'ctrack/organisations')
-rw-r--r-- | ctrack/organisations/admin.py | 2 | ||||
-rw-r--r-- | ctrack/organisations/migrations/0020_auto_20200217_2124.py | 127 | ||||
-rw-r--r-- | ctrack/organisations/migrations/0021_auto_20200217_2127.py | 28 | ||||
-rw-r--r-- | ctrack/organisations/models.py | 40 |
4 files changed, 195 insertions, 2 deletions
diff --git a/ctrack/organisations/admin.py b/ctrack/organisations/admin.py index 02f0373..a2d2b3f 100644 --- a/ctrack/organisations/admin.py +++ b/ctrack/organisations/admin.py @@ -29,7 +29,7 @@ class OrganisationAdmin(admin.ModelAdmin): class PersonAdmin(admin.ModelAdmin): model = Person - list_display = ["name", get_organisation_name, "email", "mobile"] + list_display = ["first_name", "last_name", get_organisation_name, "email", "mobile"] class RoleAdmin(admin.ModelAdmin): diff --git a/ctrack/organisations/migrations/0020_auto_20200217_2124.py b/ctrack/organisations/migrations/0020_auto_20200217_2124.py new file mode 100644 index 0000000..918efdb --- /dev/null +++ b/ctrack/organisations/migrations/0020_auto_20200217_2124.py @@ -0,0 +1,127 @@ +# Generated by Django 2.2.9 on 2020-02-17 21:24 + +import datetime +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('organisations', '0019_organisation_active'), + ] + + operations = [ + migrations.RemoveField( + model_name='person', + name='name', + ), + migrations.AddField( + model_name='person', + name='active', + field=models.BooleanField(default=True), + ), + migrations.AddField( + model_name='person', + name='clearance', + field=models.IntegerField(choices=[(1, 'NA'), (2, 'BPSS'), (3, 'CTC'), (4, 'SC'), (5, 'DV'), (6, 'Other')], default=1), + ), + migrations.AddField( + model_name='person', + name='clearance_expiry', + field=models.DateField(blank=True, default=datetime.datetime(2020, 2, 17, 21, 22, 59, 545682)), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='clearance_last_checked', + field=models.DateField(blank=True, default=datetime.datetime(2020, 2, 17, 21, 23, 6, 797385)), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='clearance_sponsor', + field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.CASCADE, to='organisations.Person'), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='clearance_start_date', + field=models.DateField(blank=True, default=datetime.datetime(2020, 2, 17, 21, 23, 40, 808513)), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='comments', + field=models.TextField(default='NA', max_length=1000), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='date_ended', + field=models.DateField(blank=True, default=datetime.datetime(2020, 2, 17, 21, 23, 53, 114873)), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='date_updated', + field=models.DateField(auto_now=True), + ), + migrations.AddField( + model_name='person', + name='first_name', + field=models.CharField(default='Malcolm', max_length=50), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='has_egress', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='person', + name='job_title', + field=models.CharField(default='Firestarter', max_length=100), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='last_name', + field=models.CharField(default='Holis-Grander', max_length=50), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='predecessor', + field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.CASCADE, related_name='previous_person', to='organisations.Person'), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='primary_nis_contact', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='person', + name='secondary_email', + field=models.EmailField(blank=True, max_length=254), + ), + migrations.AddField( + model_name='person', + name='title', + field=models.IntegerField(choices=[(1, 'Mr'), (2, 'Mrs'), (3, 'Miss'), (4, 'Ms'), (5, 'Dr.'), (6, 'Professor'), (7, 'The Rt Hon.'), (8, 'Lord'), (9, 'Lady')], default=1), + ), + migrations.AddField( + model_name='person', + name='updated_by', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + preserve_default=False, + ), + migrations.AddField( + model_name='person', + name='voluntary_point_of_contact', + field=models.BooleanField(default=False), + ), + ] diff --git a/ctrack/organisations/migrations/0021_auto_20200217_2127.py b/ctrack/organisations/migrations/0021_auto_20200217_2127.py new file mode 100644 index 0000000..4620a68 --- /dev/null +++ b/ctrack/organisations/migrations/0021_auto_20200217_2127.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.9 on 2020-02-17 21:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('organisations', '0020_auto_20200217_2124'), + ] + + operations = [ + migrations.AlterField( + model_name='person', + name='clearance_sponsor', + field=models.CharField(blank=True, max_length=100), + ), + migrations.AlterField( + model_name='person', + name='has_egress', + field=models.BooleanField(default=False, verbose_name='Has Egress'), + ), + migrations.AlterField( + model_name='person', + name='primary_nis_contact', + field=models.BooleanField(default=False, verbose_name='Primary NIS contact'), + ), + ] diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py index 7e4c624..e34c61e 100644 --- a/ctrack/organisations/models.py +++ b/ctrack/organisations/models.py @@ -23,12 +23,50 @@ class Role(models.Model): class Person(models.Model): - name = models.CharField(max_length=255) + TITLES = [ + (1, "Mr"), + (2, "Mrs"), + (3, "Miss"), + (4, "Ms"), + (5, "Dr."), + (6, "Professor"), + (7, "The Rt Hon."), + (8, "Lord"), + (9, "Lady"), + ] + + CLEARANCE_LEVEL = [ + (1, "NA"), + (2, "BPSS"), + (3, "CTC"), + (4, "SC"), + (5, "DV"), + (6, "Other"), + ] + primary_nis_contact = models.BooleanField(default=False, verbose_name="Primary NIS contact") + voluntary_point_of_contact = models.BooleanField(default=False) + has_egress = models.BooleanField(default=False, verbose_name="Has Egress") + title = models.IntegerField(choices=TITLES, default=1) + job_title = models.CharField(max_length=100) + first_name = models.CharField(max_length=50) + last_name = models.CharField(max_length=50) organisation = models.ForeignKey("Organisation", on_delete=models.CASCADE) role = models.ManyToManyField(Role) email = models.EmailField() + secondary_email = models.EmailField(blank=True) mobile = models.CharField(max_length=20, blank=True) landline = models.CharField(max_length=20, blank=True) + date_updated = models.DateField(auto_now=True) + updated_by = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) + clearance = models.IntegerField(choices=CLEARANCE_LEVEL, default=1) + clearance_sponsor = models.CharField(max_length=100, blank=True) + clearance_start_date = models.DateField(blank=True) + clearance_last_checked = models.DateField(blank=True) + clearance_expiry = models.DateField(blank=True) + active = models.BooleanField(default=True) + date_ended = models.DateField(blank=True) + predecessor = models.ForeignKey('self', blank=True, on_delete=models.CASCADE, related_name="previous_person") + comments = models.TextField(max_length=1000) def __str__(self): return self.name |