aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-21 17:08:24 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-21 17:08:35 +0100
commitecd2c19b265e3974707da0d9b8e260749dcf4a9f (patch)
treea47b8e820e98e39fca7108c1f98bc500bf0c98d9
parent07c741c785761cfa0e9895e35ba7e1f1549ce676 (diff)
renamed a field in a model to date and look what I need! new migrations and fixed tests
-rw-r--r--ctrack/assessments/migrations/0001_initial.py2
-rw-r--r--ctrack/assessments/migrations/0002_cafassessment_caf.py (renamed from ctrack/assessments/migrations/0002_auto_20201014_1605.py)8
-rw-r--r--ctrack/assessments/migrations/0003_cafassessment_completer.py22
-rw-r--r--ctrack/caf/migrations/0001_initial.py51
-rw-r--r--ctrack/caf/migrations/0002_auto_20201021_1551.py68
-rw-r--r--ctrack/organisations/migrations/0001_initial.py96
-rw-r--r--ctrack/organisations/migrations/0002_auto_20201015_1955.py26
-rw-r--r--ctrack/organisations/migrations/0002_auto_20201021_1551.py55
-rw-r--r--ctrack/organisations/templates/organisations/organisation_detail.html2
-rw-r--r--ctrack/organisations/tests/factories.py2
-rw-r--r--ctrack/organisations/views.py2
-rw-r--r--ctrack/register/admin.py2
-rw-r--r--ctrack/register/forms.py12
-rw-r--r--ctrack/register/migrations/0001_initial.py43
-rw-r--r--ctrack/register/migrations/0002_auto_20201021_1551.py (renamed from ctrack/register/migrations/0002_auto_20201014_1605.py)20
-rw-r--r--ctrack/register/migrations/0003_auto_20201015_1955.py19
-rw-r--r--ctrack/register/migrations/0004_auto_20201017_1958.py33
-rw-r--r--ctrack/register/migrations/0005_auto_20201019_0928.py24
-rw-r--r--ctrack/register/migrations/0006_auto_20201019_1935.py43
-rw-r--r--ctrack/register/models.py8
-rw-r--r--ctrack/register/tests/test_forms.py22
-rw-r--r--ctrack/register/tests/test_models.py10
-rw-r--r--ctrack/register/tests/test_views.py4
-rw-r--r--ctrack/register/views.py2
-rw-r--r--ctrack/users/migrations/0001_initial.py2
-rw-r--r--ctrack/users/tests/test_views.py2
26 files changed, 291 insertions, 289 deletions
diff --git a/ctrack/assessments/migrations/0001_initial.py b/ctrack/assessments/migrations/0001_initial.py
index a9c6a43..41c364e 100644
--- a/ctrack/assessments/migrations/0001_initial.py
+++ b/ctrack/assessments/migrations/0001_initial.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.1.2 on 2020-10-14 16:05
+# Generated by Django 3.1.2 on 2020-10-21 15:51
from django.db import migrations, models
import django.db.models.deletion
diff --git a/ctrack/assessments/migrations/0002_auto_20201014_1605.py b/ctrack/assessments/migrations/0002_cafassessment_caf.py
index 3a20060..3873b4b 100644
--- a/ctrack/assessments/migrations/0002_auto_20201014_1605.py
+++ b/ctrack/assessments/migrations/0002_cafassessment_caf.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.1.2 on 2020-10-14 16:05
+# Generated by Django 3.1.2 on 2020-10-21 15:51
from django.db import migrations, models
import django.db.models.deletion
@@ -11,7 +11,6 @@ class Migration(migrations.Migration):
dependencies = [
('caf', '0001_initial'),
('assessments', '0001_initial'),
- ('organisations', '0001_initial'),
]
operations = [
@@ -20,9 +19,4 @@ class Migration(migrations.Migration):
name='caf',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.caf'),
),
- migrations.AddField(
- model_name='cafassessment',
- name='completer',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.person'),
- ),
]
diff --git a/ctrack/assessments/migrations/0003_cafassessment_completer.py b/ctrack/assessments/migrations/0003_cafassessment_completer.py
new file mode 100644
index 0000000..db2a960
--- /dev/null
+++ b/ctrack/assessments/migrations/0003_cafassessment_completer.py
@@ -0,0 +1,22 @@
+# Generated by Django 3.1.2 on 2020-10-21 15:51
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('assessments', '0002_cafassessment_caf'),
+ ('organisations', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='cafassessment',
+ name='completer',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.person'),
+ ),
+ ]
diff --git a/ctrack/caf/migrations/0001_initial.py b/ctrack/caf/migrations/0001_initial.py
index ec2898a..c93b0a2 100644
--- a/ctrack/caf/migrations/0001_initial.py
+++ b/ctrack/caf/migrations/0001_initial.py
@@ -1,8 +1,6 @@
-# Generated by Django 3.1.2 on 2020-10-14 16:05
+# Generated by Django 3.1.2 on 2020-10-21 15:51
-import ctrack.caf.models
from django.db import migrations, models
-import django.db.models.deletion
class Migration(migrations.Migration):
@@ -10,7 +8,6 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ('organisations', '0001_initial'),
]
operations = [
@@ -28,22 +25,23 @@ class Migration(migrations.Migration):
},
),
migrations.CreateModel(
- name='Grading',
+ name='CAF',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('descriptor', models.CharField(help_text='Q1, C1, etc', max_length=2)),
- ('description', models.TextField(max_length=250)),
- ('type', models.CharField(choices=[('CONFIDENCE', 'Confidence'), ('QUALITY', 'Quality'), ('MISC', 'Misc')], help_text='Type of grading', max_length=20)),
+ ('version', models.CharField(blank=True, max_length=10, null=True)),
+ ('triage_review_date', models.DateField(blank=True, null=True)),
+ ('comments', models.TextField(max_length=1000)),
],
+ options={
+ 'verbose_name': 'CAF',
+ },
),
migrations.CreateModel(
- name='FileStore',
+ name='DocumentFile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('descriptor', models.CharField(max_length=100)),
- ('virtual_location', models.CharField(help_text='USB, Rosa, email, etc', max_length=100)),
- ('physical_location', models.CharField(blank=True, help_text='Cupboard, room, building, etc', max_length=100)),
- ('physical_location_organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation')),
+ ('name', models.CharField(max_length=255)),
+ ('type', models.IntegerField(choices=[(1, 'Excel'), (2, 'Word'), (3, 'PDF'), (4, 'Hard Copy')], default=1)),
],
),
migrations.CreateModel(
@@ -52,35 +50,24 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=256)),
('description', models.CharField(max_length=512)),
- ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation')),
- ('systems', models.ManyToManyField(to='caf.ApplicableSystem')),
],
),
migrations.CreateModel(
- name='DocumentFile',
+ name='FileStore',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=255)),
- ('type', models.IntegerField(choices=[(1, 'Excel'), (2, 'Word'), (3, 'PDF'), (4, 'Hard Copy')], default=1)),
- ('file_store_location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.filestore')),
+ ('descriptor', models.CharField(max_length=100)),
+ ('virtual_location', models.CharField(help_text='USB, Rosa, email, etc', max_length=100)),
+ ('physical_location', models.CharField(blank=True, help_text='Cupboard, room, building, etc', max_length=100)),
],
),
migrations.CreateModel(
- name='CAF',
+ name='Grading',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('version', models.CharField(blank=True, max_length=10, null=True)),
- ('triage_review_date', models.DateField(blank=True, null=True)),
- ('comments', models.TextField(max_length=1000)),
- ('confidence_grading', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='confidence_grading', to='caf.grading')),
- ('file', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.documentfile')),
- ('organisation', models.ForeignKey(on_delete=models.SET(ctrack.caf.models.CAF.get_sentinel_org), to='organisations.organisation')),
- ('quality_grading', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='quality_grading', to='caf.grading')),
- ('systems', models.ManyToManyField(to='caf.ApplicableSystem')),
- ('triage_review_inspector', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.person')),
+ ('descriptor', models.CharField(help_text='Q1, C1, etc', max_length=2)),
+ ('description', models.TextField(max_length=250)),
+ ('type', models.CharField(choices=[('CONFIDENCE', 'Confidence'), ('QUALITY', 'Quality'), ('MISC', 'Misc')], help_text='Type of grading', max_length=20)),
],
- options={
- 'verbose_name': 'CAF',
- },
),
]
diff --git a/ctrack/caf/migrations/0002_auto_20201021_1551.py b/ctrack/caf/migrations/0002_auto_20201021_1551.py
new file mode 100644
index 0000000..bb9659e
--- /dev/null
+++ b/ctrack/caf/migrations/0002_auto_20201021_1551.py
@@ -0,0 +1,68 @@
+# Generated by Django 3.1.2 on 2020-10-21 15:51
+
+import ctrack.caf.models
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('caf', '0001_initial'),
+ ('organisations', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='filestore',
+ name='physical_location_organisation',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation'),
+ ),
+ migrations.AddField(
+ model_name='essentialservice',
+ name='organisation',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation'),
+ ),
+ migrations.AddField(
+ model_name='essentialservice',
+ name='systems',
+ field=models.ManyToManyField(to='caf.ApplicableSystem'),
+ ),
+ migrations.AddField(
+ model_name='documentfile',
+ name='file_store_location',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.filestore'),
+ ),
+ migrations.AddField(
+ model_name='caf',
+ name='confidence_grading',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='confidence_grading', to='caf.grading'),
+ ),
+ migrations.AddField(
+ model_name='caf',
+ name='file',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.documentfile'),
+ ),
+ migrations.AddField(
+ model_name='caf',
+ name='organisation',
+ field=models.ForeignKey(on_delete=models.SET(ctrack.caf.models.CAF.get_sentinel_org), to='organisations.organisation'),
+ ),
+ migrations.AddField(
+ model_name='caf',
+ name='quality_grading',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='quality_grading', to='caf.grading'),
+ ),
+ migrations.AddField(
+ model_name='caf',
+ name='systems',
+ field=models.ManyToManyField(to='caf.ApplicableSystem'),
+ ),
+ migrations.AddField(
+ model_name='caf',
+ name='triage_review_inspector',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.person'),
+ ),
+ ]
diff --git a/ctrack/organisations/migrations/0001_initial.py b/ctrack/organisations/migrations/0001_initial.py
index c5ab495..e13cafb 100644
--- a/ctrack/organisations/migrations/0001_initial.py
+++ b/ctrack/organisations/migrations/0001_initial.py
@@ -1,6 +1,5 @@
-# Generated by Django 2.2.12 on 2020-08-27 09:40
+# Generated by Django 3.1.2 on 2020-10-21 15:51
-import django.contrib.auth
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
@@ -15,6 +14,23 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
+ name='Address',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('line1', models.CharField(max_length=255)),
+ ('line2', models.CharField(blank=True, max_length=255)),
+ ('line3', models.CharField(blank=True, max_length=255)),
+ ('city', models.CharField(max_length=100)),
+ ('county', models.CharField(blank=True, max_length=100)),
+ ('postcode', models.CharField(max_length=10)),
+ ('country', models.CharField(max_length=100)),
+ ('other_details', models.CharField(blank=True, max_length=255)),
+ ],
+ options={
+ 'verbose_name_plural': 'Addresses',
+ },
+ ),
+ migrations.CreateModel(
name='AddressType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
@@ -22,6 +38,27 @@ class Migration(migrations.Migration):
],
),
migrations.CreateModel(
+ name='IncidentReport',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('person_involved', models.CharField(blank=True, max_length=100, verbose_name='Name of person reporting/detecting incident')),
+ ('role', models.CharField(blank=True, help_text='Role of person reporting/detecting incident', max_length=100)),
+ ('phone_number', models.CharField(max_length=30)),
+ ('email', models.EmailField(max_length=254)),
+ ('internal_incident_number', models.CharField(blank=True, max_length=30)),
+ ('date_time_incident_detected', models.DateTimeField(verbose_name='Date/Time incident detected')),
+ ('date_time_incident_reported', models.DateTimeField(auto_now=True, verbose_name='Date/Time incident reported')),
+ ('incident_type', models.CharField(choices=[('Cyber', 'Cyber'), ('Non-Cyber', 'Non-Cyber'), ('Both', 'Both'), ('Power Outage', 'Power Outage')], help_text='This can be appoximate', max_length=20)),
+ ('incident_status', models.CharField(choices=[('Detected', 'Detected'), ('Suspected', 'Suspected'), ('Resolved', 'Resolved')], max_length=20)),
+ ('incident_stage', models.CharField(choices=[('Ongoing', 'Ongoing'), ('Ended', 'Ended'), ('Ongoing but managed', 'Ongoing but managed')], max_length=20)),
+ ('summary', models.TextField(help_text='Please provide a summary of your understanding of the incident, including any impact to services and/or users.')),
+ ('mitigations', models.TextField(help_text='What investigations and/or mitigations have you or a third party performed or plan to perform?', verbose_name='Investigations or mitigations')),
+ ('others_informed', models.TextField(help_text='Who else has been informed about this incident?(CSIRT, NCSC, NCA, etc)', verbose_name='Others parties informed')),
+ ('next_steps', models.TextField(help_text='What are your planned next steps?', verbose_name='Planned next steps')),
+ ('dft_handle_status', models.CharField(choices=[('QUEUED', 'QUEUED'), ('REVIEWING', 'REVIEWING'), ('WAITING', 'WAITING'), ('COMPLETED', 'COMPLETED')], default='QUEUED', max_length=20)),
+ ],
+ ),
+ migrations.CreateModel(
name='Mode',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
@@ -67,8 +104,8 @@ class Migration(migrations.Migration):
('active', models.BooleanField(default=True)),
('date_ended', models.DateField(blank=True, null=True)),
('comments', models.TextField(blank=True, max_length=1000)),
- ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')),
- ('predecessor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='previous_person', to='organisations.Person')),
+ ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation')),
+ ('predecessor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='previous_person', to='organisations.person')),
],
options={
'verbose_name_plural': 'People',
@@ -86,14 +123,14 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('descriptor', models.CharField(max_length=100)),
- ('mode', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Mode')),
+ ('mode', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.mode')),
],
),
migrations.CreateModel(
name='Stakeholder',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Person')),
+ ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.person')),
],
),
migrations.AddField(
@@ -101,51 +138,4 @@ class Migration(migrations.Migration):
name='role',
field=models.ManyToManyField(to='organisations.Role'),
),
- migrations.AddField(
- model_name='organisation',
- name='submode',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.Submode'),
- ),
- migrations.CreateModel(
- name='IncidentReport',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('person_involved', models.CharField(blank=True, max_length=100, verbose_name='Name of person reporting/detecting incident')),
- ('role', models.CharField(blank=True, help_text='Role of person reporting/detecting incident', max_length=100)),
- ('phone_number', models.CharField(max_length=30)),
- ('email', models.EmailField(max_length=254)),
- ('internal_incident_number', models.CharField(blank=True, max_length=30)),
- ('date_time_incident_detected', models.DateTimeField(verbose_name='Date/Time incident detected')),
- ('date_time_incident_reported', models.DateTimeField(auto_now=True, verbose_name='Date/Time incident reported')),
- ('incident_type', models.CharField(choices=[('Cyber', 'Cyber'), ('Non-Cyber', 'Non-Cyber'), ('Both', 'Both'), ('Power Outage', 'Power Outage')], help_text='This can be appoximate', max_length=20)),
- ('incident_status', models.CharField(choices=[('Detected', 'Detected'), ('Suspected', 'Suspected'), ('Resolved', 'Resolved')], max_length=20)),
- ('incident_stage', models.CharField(choices=[('Ongoing', 'Ongoing'), ('Ended', 'Ended'), ('Ongoing but managed', 'Ongoing but managed')], max_length=20)),
- ('summary', models.TextField(help_text='Please provide a summary of your understanding of the incident, including any impact to services and/or users.')),
- ('mitigations', models.TextField(help_text='What investigations and/or mitigations have you or a third party performed or plan to perform?', verbose_name='Investigations or mitigations')),
- ('others_informed', models.TextField(help_text='Who else has been informed about this incident?(CSIRT, NCSC, NCA, etc)', verbose_name='Others parties informed')),
- ('next_steps', models.TextField(help_text='What are your planned next steps?', verbose_name='Planned next steps')),
- ('dft_handle_status', models.CharField(choices=[('QUEUED', 'QUEUED'), ('REVIEWING', 'REVIEWING'), ('WAITING', 'WAITING'), ('COMPLETED', 'COMPLETED')], default='QUEUED', max_length=20)),
- ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')),
- ('reporting_person', models.ForeignKey(on_delete=models.SET(django.contrib.auth.get_user_model), to='organisations.Person', verbose_name='Person reporting the incident')),
- ],
- ),
- migrations.CreateModel(
- name='Address',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('line1', models.CharField(max_length=255)),
- ('line2', models.CharField(blank=True, max_length=255)),
- ('line3', models.CharField(blank=True, max_length=255)),
- ('city', models.CharField(max_length=100)),
- ('county', models.CharField(blank=True, max_length=100)),
- ('postcode', models.CharField(max_length=10)),
- ('country', models.CharField(max_length=100)),
- ('other_details', models.CharField(blank=True, max_length=255)),
- ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='addresses', to='organisations.Organisation')),
- ('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.AddressType', verbose_name='Address Type')),
- ],
- options={
- 'verbose_name_plural': 'Addresses',
- },
- ),
]
diff --git a/ctrack/organisations/migrations/0002_auto_20201015_1955.py b/ctrack/organisations/migrations/0002_auto_20201015_1955.py
deleted file mode 100644
index dcc2463..0000000
--- a/ctrack/organisations/migrations/0002_auto_20201015_1955.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated by Django 3.1.2 on 2020-10-15 19:55
-
-import ctrack.organisations.models
-from django.conf import settings
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('organisations', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='organisation',
- name='deputy_lead_inspector',
- field=models.ForeignKey(null=True, on_delete=models.SET(ctrack.organisations.models.Organisation.get_sentinel_user), related_name='deputy_inspector', to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='organisation',
- name='lead_inspector',
- field=models.ForeignKey(null=True, on_delete=models.SET(ctrack.organisations.models.Organisation.get_sentinel_user), related_name='lead_inspector', to=settings.AUTH_USER_MODEL),
- ),
- ]
diff --git a/ctrack/organisations/migrations/0002_auto_20201021_1551.py b/ctrack/organisations/migrations/0002_auto_20201021_1551.py
new file mode 100644
index 0000000..b9afa58
--- /dev/null
+++ b/ctrack/organisations/migrations/0002_auto_20201021_1551.py
@@ -0,0 +1,55 @@
+# Generated by Django 3.1.2 on 2020-10-21 15:51
+
+import ctrack.organisations.models
+from django.conf import settings
+import django.contrib.auth
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('organisations', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='organisation',
+ name='deputy_lead_inspector',
+ field=models.ForeignKey(null=True, on_delete=models.SET(ctrack.organisations.models.Organisation.get_sentinel_user), related_name='deputy_inspector', to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AddField(
+ model_name='organisation',
+ name='lead_inspector',
+ field=models.ForeignKey(null=True, on_delete=models.SET(ctrack.organisations.models.Organisation.get_sentinel_user), related_name='lead_inspector', to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AddField(
+ model_name='organisation',
+ name='submode',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.submode'),
+ ),
+ migrations.AddField(
+ model_name='incidentreport',
+ name='organisation',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation'),
+ ),
+ migrations.AddField(
+ model_name='incidentreport',
+ name='reporting_person',
+ field=models.ForeignKey(on_delete=models.SET(django.contrib.auth.get_user_model), to='organisations.person', verbose_name='Person reporting the incident'),
+ ),
+ migrations.AddField(
+ model_name='address',
+ name='organisation',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='addresses', to='organisations.organisation'),
+ ),
+ migrations.AddField(
+ model_name='address',
+ name='type',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.addresstype', verbose_name='Address Type'),
+ ),
+ ]
diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html
index cb5a54d..fe744fe 100644
--- a/ctrack/organisations/templates/organisations/organisation_detail.html
+++ b/ctrack/organisations/templates/organisations/organisation_detail.html
@@ -150,7 +150,7 @@
</h5>
<div class="card-subtitle mb-2">
<span class="badge badge-info">{{ event.type_descriptor }}</span>
- <span class="badge badge-light">{{ event.datetime|date:"l j F Y" }}, {{ event.datetime|date:"G:i" }}</span></h5>
+ <span class="badge badge-light">{{ event.date|date:"l j F Y" }}, {{ event.datetime|date:"G:i" }}</span></h5>
</div>
<p class="card-text">{{ event.comments }}</p>
Participants:
diff --git a/ctrack/organisations/tests/factories.py b/ctrack/organisations/tests/factories.py
index 330ad79..22f6430 100644
--- a/ctrack/organisations/tests/factories.py
+++ b/ctrack/organisations/tests/factories.py
@@ -125,7 +125,7 @@ class AddressFactory(DjangoModelFactory):
class SingleDateTimeEventFactory(DjangoModelFactory):
type_descriptor = None # must pass this in
short_description = "Nothing short description"
- datetime = "2020-02-10 10:00"
+ date = "2020-02-10 10:00"
comments = "Nothing comments"
location = "Gark's basin"
user = SubFactory(UserFactory)
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py
index 5726aa2..324f933 100644
--- a/ctrack/organisations/views.py
+++ b/ctrack/organisations/views.py
@@ -122,7 +122,7 @@ class OrganisationDetailView(PermissionRequiredMixin, DetailView):
]
flat_sdes = sorted(
list(itertools.chain.from_iterable(_sdes)),
- key=lambda e: e.datetime,
+ key=lambda e: e.date,
reverse=True,
)
diff --git a/ctrack/register/admin.py b/ctrack/register/admin.py
index 6e6aa26..a896b26 100644
--- a/ctrack/register/admin.py
+++ b/ctrack/register/admin.py
@@ -16,7 +16,7 @@ class EngagementEventTypeAdmin(admin.ModelAdmin):
class SingleDateTimeEventAdmin(admin.ModelAdmin):
model = SingleDateTimeEvent
- list_display = ("type_descriptor", "short_description", "datetime", "user", "created_date")
+ list_display = ("type_descriptor", "short_description", "date", "user", "created_date")
class CAFSingleDateEventAdmin(admin.ModelAdmin):
diff --git a/ctrack/register/forms.py b/ctrack/register/forms.py
index cca4cb9..5a612e9 100644
--- a/ctrack/register/forms.py
+++ b/ctrack/register/forms.py
@@ -51,7 +51,7 @@ class CreateSimpleDateTimeEventForm(forms.ModelForm):
"type_descriptor",
"private",
"short_description",
- "datetime",
+ "date",
"participants",
"requested_response_date",
"response_received_date",
@@ -84,7 +84,7 @@ class CreateSimpleDateTimeEventForm(forms.ModelForm):
def clean(self):
cleaned_data = super().clean()
- date = cleaned_data.get("datetime")
+ date = cleaned_data.get("date")
if not date:
return cleaned_data
# WOOO - walrus operator
@@ -128,11 +128,11 @@ class CAFSingleDateEventForm(forms.ModelForm):
class CAFTwinDateEventForm(forms.ModelForm):
# This constraint in the form prevents two such objects being created
# for the same CAF with the same start date, which does not make sense.
- def clean_start_date(self):
- data = self.cleaned_data["start_date"]
+ def clean_date(self):
+ data = self.cleaned_data["date"]
caf = self.cleaned_data["related_caf"]
existing_obj = (
- CAFTwinDateEvent.objects.filter(start_date=data)
+ CAFTwinDateEvent.objects.filter(date=data)
.filter(related_caf=caf)
.first()
)
@@ -148,7 +148,7 @@ class CAFTwinDateEventForm(forms.ModelForm):
"type_descriptor",
"related_caf",
"short_description",
- "start_date",
+ "date",
"end_date",
"comments",
]
diff --git a/ctrack/register/migrations/0001_initial.py b/ctrack/register/migrations/0001_initial.py
index 1986518..863c575 100644
--- a/ctrack/register/migrations/0001_initial.py
+++ b/ctrack/register/migrations/0001_initial.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.1.2 on 2020-10-14 16:05
+# Generated by Django 3.1.2 on 2020-10-21 15:51
from django.db import migrations, models
@@ -19,10 +19,10 @@ class Migration(migrations.Migration):
('created_date', models.DateTimeField()),
('modified_date', models.DateTimeField()),
('short_description', models.CharField(help_text='Short description of the event. Use Comments field for full detail.', max_length=50)),
- ('document_link', models.URLField(blank=True, help_text='URL only - do not try to drag a file here.', max_length=1000, null=True)),
+ ('document_link', models.URLField(blank=True, help_text='Use this to link to documents on TiME/Sharepoint or elsewhere.', max_length=1000, null=True)),
('comments', models.TextField(blank=True, help_text='Use this to provide further detail about the event.', max_length=1000, null=True)),
- ('date', models.DateField()),
- ('type_descriptor', models.CharField(choices=[('CAF_INITIAL_CAF_RECEIVED', 'CAF - Initial CAF Received'), ('CAF_FEEDBACK_EMAILED_OES', 'CAF - Emailed to OES'), ('CAF_RECEIVED', 'CAF - Received'), ('CAF_EMAILED_ROSA', 'CAF - Emailed to Rosa'), ('CAF_VALIDATION_SIGN_OFF', 'CAF - Validation Sign Off'), ('CAF_VALIDATION_RECORD_EMAILED_TO_OES', 'CAF - Validation Record Sent to OES')], max_length=50)),
+ ('date', models.DateField(help_text='DD/MM/YY format')),
+ ('type_descriptor', models.CharField(choices=[('CAF_INITIAL_CAF_RECEIVED', 'CAF - Initial CAF Received'), ('CAF_FEEDBACK_EMAILED_OES', 'CAF - Emailed to OES'), ('CAF_RECEIVED', 'CAF - Received'), ('CAF_EMAILED_ROSA', 'CAF - Emailed to Rosa'), ('CAF_VALIDATION_SIGN_OFF', 'CAF - Validation Sign Off'), ('CAF_VALIDATION_RECORD_EMAILED_TO_OES', 'CAF - Validation Record Sent to OES')], help_text='Select the event type', max_length=50, verbose_name='Type')),
],
),
migrations.CreateModel(
@@ -32,9 +32,9 @@ class Migration(migrations.Migration):
('created_date', models.DateTimeField()),
('modified_date', models.DateTimeField()),
('short_description', models.CharField(help_text='Short description of the event. Use Comments field for full detail.', max_length=50)),
- ('document_link', models.URLField(blank=True, help_text='URL only - do not try to drag a file here.', max_length=1000, null=True)),
+ ('document_link', models.URLField(blank=True, help_text='Use this to link to documents on TiME/Sharepoint or elsewhere.', max_length=1000, null=True)),
('comments', models.TextField(blank=True, help_text='Use this to provide further detail about the event.', max_length=1000, null=True)),
- ('start_date', models.DateField()),
+ ('date', models.DateField()),
('end_date', models.DateField(blank=True, null=True)),
('type_descriptor', models.CharField(choices=[('CAF_PEER_REVIEW_PERIOD', 'CAF - Peer Review Period'), ('CAF_VALIDATION_PERIOD', 'CAF - Validation Period')], max_length=50)),
],
@@ -64,20 +64,41 @@ class Migration(migrations.Migration):
],
),
migrations.CreateModel(
+ name='NoteEvent',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created_date', models.DateTimeField()),
+ ('modified_date', models.DateTimeField()),
+ ('short_description', models.CharField(help_text='Short description of the event. Use Comments field for full detail.', max_length=50)),
+ ('document_link', models.URLField(blank=True, help_text='Use this to link to documents on TiME/Sharepoint or elsewhere.', max_length=1000, null=True)),
+ ('comments', models.TextField(blank=True, help_text='Use this to provide further detail about the event.', max_length=1000, null=True)),
+ ('url', models.URLField(blank=True, help_text='If recording an email, please link to it here. Do not paste the text in the comments box.', max_length=400, null=True, verbose_name='URL')),
+ ('requested_response_date', models.DateField(blank=True, help_text='DD/MM/YY format', null=True)),
+ ('response_received_date', models.DateField(blank=True, help_text='DD/MM/YY format', null=True)),
+ ('private', models.BooleanField(default=False, help_text='Private events can only be seen by you. Official records should not be private, but you can use private events to track your own work.')),
+ ('type_descriptor', models.CharField(default='NOTE', max_length=50)),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ migrations.CreateModel(
name='SingleDateTimeEvent',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_date', models.DateTimeField()),
('modified_date', models.DateTimeField()),
('short_description', models.CharField(help_text='Short description of the event. Use Comments field for full detail.', max_length=50)),
- ('document_link', models.URLField(blank=True, help_text='URL only - do not try to drag a file here.', max_length=1000, null=True)),
+ ('document_link', models.URLField(blank=True, help_text='Use this to link to documents on TiME/Sharepoint or elsewhere.', max_length=1000, null=True)),
('comments', models.TextField(blank=True, help_text='Use this to provide further detail about the event.', max_length=1000, null=True)),
- ('location', models.CharField(blank=True, max_length=100)),
- ('datetime', models.DateTimeField(help_text='DD/MM/YY HH:MM format please!', verbose_name='Date/Time')),
+ ('location', models.CharField(blank=True, help_text='If event involved a physical location, indicate here.', max_length=100)),
+ ('url', models.URLField(blank=True, help_text='If recording an email, please link to it here. Do not paste the text in the comments box.', max_length=400, null=True, verbose_name='URL')),
+ ('date', models.DateTimeField(help_text='DD/MM/YY HH:MM format please!', verbose_name='Date/Time')),
('requested_response_date', models.DateField(blank=True, help_text='DD/MM/YY format', null=True)),
('response_received_date', models.DateField(blank=True, help_text='DD/MM/YY format', null=True)),
- ('type_descriptor', models.CharField(choices=[('MEETING', 'Meeting'), ('PHONE_CALL', 'Phone Call'), ('VIDEO_CALL', 'Video Call'), ('EMAIL', 'Email')], max_length=50)),
- ('participants', models.ManyToManyField(blank=True, null=True, to='organisations.Person')),
+ ('private', models.BooleanField(default=False, help_text='Private events can only be seen by you. Official records should not be private, but you can use private events to track your own work.')),
+ ('type_descriptor', models.CharField(choices=[('MEETING', 'Meeting'), ('PHONE_CALL', 'Phone Call'), ('VIDEO_CALL', 'Video Call'), ('EMAIL', 'Email')], max_length=50, verbose_name='Event Type')),
+ ('participants', models.ManyToManyField(to='organisations.Person')),
],
options={
'abstract': False,
diff --git a/ctrack/register/migrations/0002_auto_20201014_1605.py b/ctrack/register/migrations/0002_auto_20201021_1551.py
index 0d4b440..93c02c8 100644
--- a/ctrack/register/migrations/0002_auto_20201014_1605.py
+++ b/ctrack/register/migrations/0002_auto_20201021_1551.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.1.2 on 2020-10-14 16:05
+# Generated by Django 3.1.2 on 2020-10-21 15:51
import ctrack.register.models
from django.conf import settings
@@ -12,10 +12,10 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('organisations', '0001_initial'),
- ('caf', '0001_initial'),
+ ('organisations', '0002_auto_20201021_1551'),
('register', '0001_initial'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('caf', '0002_auto_20201021_1551'),
]
operations = [
@@ -25,6 +25,16 @@ class Migration(migrations.Migration):
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
+ model_name='noteevent',
+ name='organisation',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation'),
+ ),
+ migrations.AddField(
+ model_name='noteevent',
+ name='user',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AddField(
model_name='engagementevent',
name='participants',
field=models.ManyToManyField(blank=True, to='organisations.Person'),
@@ -66,7 +76,7 @@ class Migration(migrations.Migration):
),
migrations.AddConstraint(
model_name='caftwindateevent',
- constraint=models.CheckConstraint(check=models.Q(_negated=True, end_date__lt=django.db.models.expressions.F('start_date')), name='register_caftwindateevent_cannot_precede_start_date'),
+ constraint=models.CheckConstraint(check=models.Q(_negated=True, end_date__lt=django.db.models.expressions.F('date')), name='register_caftwindateevent_cannot_precede_start_date'),
),
migrations.AddConstraint(
model_name='cafsingledateevent',
diff --git a/ctrack/register/migrations/0003_auto_20201015_1955.py b/ctrack/register/migrations/0003_auto_20201015_1955.py
deleted file mode 100644
index 58d11c1..0000000
--- a/ctrack/register/migrations/0003_auto_20201015_1955.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated by Django 3.1.2 on 2020-10-15 19:55
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('organisations', '0002_auto_20201015_1955'),
- ('register', '0002_auto_20201014_1605'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='singledatetimeevent',
- name='participants',
- field=models.ManyToManyField(blank=True, to='organisations.Person'),
- ),
- ]
diff --git a/ctrack/register/migrations/0004_auto_20201017_1958.py b/ctrack/register/migrations/0004_auto_20201017_1958.py
deleted file mode 100644
index d13903d..0000000
--- a/ctrack/register/migrations/0004_auto_20201017_1958.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Generated by Django 3.1.2 on 2020-10-17 19:58
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('register', '0003_auto_20201015_1955'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='singledatetimeevent',
- name='private',
- field=models.BooleanField(default=False, help_text='Private events can only be seen by you. Official records should not be private, but you can use private events to track your own work.'),
- ),
- migrations.AddField(
- model_name='singledatetimeevent',
- name='url',
- field=models.URLField(blank=True, help_text='If recording an email, please link to it here. Do not paste the text in the comments box.', max_length=400, null=True, verbose_name='URL'),
- ),
- migrations.AlterField(
- model_name='singledatetimeevent',
- name='location',
- field=models.CharField(blank=True, help_text='If event involved a physical location, indicate here.', max_length=100),
- ),
- migrations.AlterField(
- model_name='singledatetimeevent',
- name='type_descriptor',
- field=models.CharField(choices=[('MEETING', 'Meeting'), ('PHONE_CALL', 'Phone Call'), ('VIDEO_CALL', 'Video Call'), ('EMAIL', 'Email'), ('NOTE', 'Note')], max_length=50),
- ),
- ]
diff --git a/ctrack/register/migrations/0005_auto_20201019_0928.py b/ctrack/register/migrations/0005_auto_20201019_0928.py
deleted file mode 100644
index ed6f6b5..0000000
--- a/ctrack/register/migrations/0005_auto_20201019_0928.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Generated by Django 3.1.2 on 2020-10-19 09:28
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('organisations', '0002_auto_20201015_1955'),
- ('register', '0004_auto_20201017_1958'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='singledatetimeevent',
- name='participants',
- field=models.ManyToManyField(to='organisations.Person'),
- ),
- migrations.AlterField(
- model_name='singledatetimeevent',
- name='type_descriptor',
- field=models.CharField(choices=[('MEETING', 'Meeting'), ('PHONE_CALL', 'Phone Call'), ('VIDEO_CALL', 'Video Call'), ('EMAIL', 'Email'), ('NOTE', 'Note')], max_length=50, verbose_name='Event Type'),
- ),
- ]
diff --git a/ctrack/register/migrations/0006_auto_20201019_1935.py b/ctrack/register/migrations/0006_auto_20201019_1935.py
deleted file mode 100644
index 291b594..0000000
--- a/ctrack/register/migrations/0006_auto_20201019_1935.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Generated by Django 3.1.2 on 2020-10-19 19:35
-
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('organisations', '0002_auto_20201015_1955'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('register', '0005_auto_20201019_0928'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='singledatetimeevent',
- name='type_descriptor',
- field=models.CharField(choices=[('MEETING', 'Meeting'), ('PHONE_CALL', 'Phone Call'), ('VIDEO_CALL', 'Video Call'), ('EMAIL', 'Email')], max_length=50, verbose_name='Event Type'),
- ),
- migrations.CreateModel(
- name='NoteEvent',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created_date', models.DateTimeField()),
- ('modified_date', models.DateTimeField()),
- ('short_description', models.CharField(help_text='Short description of the event. Use Comments field for full detail.', max_length=50)),
- ('document_link', models.URLField(blank=True, help_text='URL only - do not try to drag a file here.', max_length=1000, null=True)),
- ('comments', models.TextField(blank=True, help_text='Use this to provide further detail about the event.', max_length=1000, null=True)),
- ('url', models.URLField(blank=True, help_text='If recording an email, please link to it here. Do not paste the text in the comments box.', max_length=400, null=True, verbose_name='URL')),
- ('requested_response_date', models.DateField(blank=True, help_text='DD/MM/YY format', null=True)),
- ('response_received_date', models.DateField(blank=True, help_text='DD/MM/YY format', null=True)),
- ('private', models.BooleanField(default=False, help_text='Private events can only be seen by you. Official records should not be private, but you can use private events to track your own work.')),
- ('type_descriptor', models.CharField(default='NOTE', max_length=50)),
- ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.organisation')),
- ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
- ],
- options={
- 'abstract': False,
- },
- ),
- ]
diff --git a/ctrack/register/models.py b/ctrack/register/models.py
index 1ce905a..34dc880 100644
--- a/ctrack/register/models.py
+++ b/ctrack/register/models.py
@@ -117,7 +117,7 @@ class URLEventMixin(models.Model):
class SingleDateTimeEventMixin(models.Model):
- datetime = models.DateTimeField(
+ date = models.DateTimeField(
blank=False, verbose_name="Date/Time", help_text="DD/MM/YY HH:MM format please!"
)
@@ -133,7 +133,7 @@ class SingleDateMixin(models.Model):
class TwinDateMixin(models.Model):
- start_date = models.DateField(blank=False, null=False)
+ date = models.DateField(blank=False, null=False)
end_date = models.DateField(blank=True, null=True)
class Meta:
@@ -249,13 +249,13 @@ class CAFTwinDateEvent(EventBase, CAFMixin, TwinDateMixin):
return "".join(["CAFTwinDateEvent(", self.type_descriptor, ")"])
def __str__(self):
- return f"CAFTwinDateEvent({self.type_descriptor}) starting {self.start_date}"
+ return f"CAFTwinDateEvent({self.type_descriptor}) starting {self.date}"
class Meta:
constraints = [
models.CheckConstraint(
name="%(app_label)s_%(class)s_cannot_precede_start_date",
- check=~models.Q(end_date__lt=F("start_date")),
+ check=~models.Q(end_date__lt=F("date")),
)
]
diff --git a/ctrack/register/tests/test_forms.py b/ctrack/register/tests/test_forms.py
index e059cdf..5a055b6 100644
--- a/ctrack/register/tests/test_forms.py
+++ b/ctrack/register/tests/test_forms.py
@@ -15,7 +15,7 @@ def test_init(user, org_with_people):
{
"type_descriptor": "MEETING", # Must be Meeting as that is in the choices param
"short_description": "Test short description",
- "datetime": "2010-10-10T13:00",
+ "date": "2010-10-10T13:00",
"comments": "Test Comments",
"location": "Transient Moats",
"participants": people_from_org
@@ -33,7 +33,7 @@ def test_simple_event_limited_to_org_participants(user, org, person):
{
"type_descriptor": "PHONE_CALL",
"short_description": "Test Short Description",
- "datetime": "2010-10-10 10:00",
+ "date": "2010-10-10 10:00",
"requested_response_date": "2020-12-24",
"response_received_date": "2020-12-25",
"participants": people_from_org,
@@ -49,7 +49,7 @@ def test_cannot_create_disallowed_single_date_event_type_with_form(user, org_wit
{
"type_descriptor": "NOT ALLOWED EVENT",
"short_description": "Test short description",
- "datetime": "2020-10-10",
+ "date": "2020-10-10",
"comments": "Test Comments",
"participants": org_with_people.get_people()
},
@@ -68,7 +68,7 @@ def test_create_simple_datetime_event(user, org_with_people):
{
"type_descriptor": "PHONE_CALL",
"short_description": "Test Short Description",
- "datetime": "2010-10-10 10:00",
+ "date": "2010-10-10 10:00",
"requested_response_date": "2020-12-24",
"response_received_date": "2020-12-25",
"url": "https://fake.url.com",
@@ -84,7 +84,7 @@ def test_response_date_cannot_be_before_date(user, org_with_people):
{
"type_descriptor": "PHONE_CALL",
"short_description": "Test Short Description",
- "datetime": "2010-10-10 10:00",
+ "date": "2010-10-10 10:00",
"requested_response_date": "2009-12-24",
"response_received_date": None,
"comments": "Test Comments not needed",
@@ -107,7 +107,7 @@ def test_meeting_blank_data(user, org_with_people):
user=user, org_slug=None
)
assert form.is_valid() is False
- assert form.errors == {"datetime": ["This field is required."]}
+ assert form.errors == {"date": ["This field is required."]}
def test_create_note(user, org_with_people):
@@ -214,7 +214,7 @@ def test_caf_twin_date_event(user, caf):
"type_descriptor": "CAF_PEER_REVIEW_PERIOD",
"related_caf": caf,
"short_description": "Test Description",
- "start_date": "2009-10-01",
+ "date": "2009-10-01",
"end_date": "2015-10-1",
"comments": "Meaningless comments",
},
@@ -230,7 +230,7 @@ def test_cannot_create_twin_date_event_for_caf_whose_end_date_is_open(allowed_ty
"type_descriptor": allowed_type,
"related_caf": caf,
"short_description": "caf peer review for x company",
- "start_date": "2020-10-10",
+ "date": "2020-10-10",
"comments": "nice comments for this event",
},
user=user,
@@ -240,7 +240,7 @@ def test_cannot_create_twin_date_event_for_caf_whose_end_date_is_open(allowed_ty
"type_descriptor": allowed_type,
"related_caf": caf,
"short_description": "caf peer review for x company",
- "start_date": "2020-10-10",
+ "date": "2020-10-10",
"comments": "nice comments for this event",
},
user=user,
@@ -249,7 +249,7 @@ def test_cannot_create_twin_date_event_for_caf_whose_end_date_is_open(allowed_ty
e1.save()
assert e2.is_valid() is False
assert e2.errors == {
- "start_date": ["You cannot have two CAF events starting on the same date."]
+ "date": ["You cannot have two CAF events starting on the same date."]
}
@@ -262,7 +262,7 @@ def test_cannot_create_twin_date_event_where_end_date_precedes_start(allowed_typ
"type_descriptor": allowed_type,
"related_caf": caf,
"short_description": "caf peer review for x company",
- "start_date": "2020-10-10",
+ "date": "2020-10-10",
"end_date": "2020-10-09",
"comments": "nice comments for this event",
},
diff --git a/ctrack/register/tests/test_models.py b/ctrack/register/tests/test_models.py
index aafd37f..1a89fd5 100644
--- a/ctrack/register/tests/test_models.py
+++ b/ctrack/register/tests/test_models.py
@@ -47,7 +47,7 @@ def test_caf_twin_date_events(allowed_type, user, caf):
type_descriptor=allowed_type,
related_caf=caf,
short_description="CAF received for X Company",
- start_date="2020-10-10",
+ date="2020-10-10",
end_date="2020-10-25",
comments="Nice comments for this event",
user=user,
@@ -64,7 +64,7 @@ def test_caf_twin_date_event_no_end_date(allowed_type, user, caf):
type_descriptor=allowed_type,
related_caf=caf,
short_description="CAF received for X Company",
- start_date="2020-10-10",
+ date="2020-10-10",
comments="Nice comments for this event",
user=user,
)
@@ -173,7 +173,7 @@ def test_single_datetime_event(person, user, allowed_type):
url="http://fake.url.com",
requested_response_date="2021-01-24",
response_received_date=None,
- datetime="2020-10-10T15:00",
+ date="2020-10-10T15:00",
comments="Comments on important event",
# location is optional
user=user,
@@ -192,7 +192,7 @@ def test_cannot_create_twin_date_event_model_end_date_precedes_start(allowed_typ
CAFTwinDateEvent.objects.create(
type_descriptor=allowed_type,
related_caf=caf,
- start_date="2010-10-10",
+ date="2010-10-10",
end_date="2010-01-01",
short_description="Bobbins",
user=user,
@@ -205,7 +205,7 @@ def test_meeting_event(user, person):
e = SingleDateTimeEvent.objects.create(
type_descriptor="Meeting",
short_description="Big Important Meeting",
- datetime="2020-10-10T15:00",
+ date="2020-10-10T15:00",
comments="Nice comments",
location="Harvey's House",
user=user,
diff --git a/ctrack/register/tests/test_views.py b/ctrack/register/tests/test_views.py
index 4e8152c..4158692 100644
--- a/ctrack/register/tests/test_views.py
+++ b/ctrack/register/tests/test_views.py
@@ -25,7 +25,7 @@ class TestSingleDateTimeEvent:
expected_fields = [
"type_descriptor",
"short_description",
- "datetime",
+ "date",
"comments",
"location",
]
@@ -47,7 +47,7 @@ class TestSingleDateTimeEvent:
data = {
"type_descriptor": "MEETING",
"short_description": "Test Short Description",
- "datetime": bad_date,
+ "date": bad_date,
"comments": "Blah...",
"location": "The Moon",
}
diff --git a/ctrack/register/views.py b/ctrack/register/views.py
index c8fe1c5..d5b39f3 100644
--- a/ctrack/register/views.py
+++ b/ctrack/register/views.py
@@ -99,7 +99,7 @@ class SingleDateTimeEventUpdate(UpdateView):
fields = [
"type_descriptor",
"short_description",
- "datetime",
+ "date",
"private",
"document_link",
"comments",
diff --git a/ctrack/users/migrations/0001_initial.py b/ctrack/users/migrations/0001_initial.py
index ec91581..a781a77 100644
--- a/ctrack/users/migrations/0001_initial.py
+++ b/ctrack/users/migrations/0001_initial.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.1.2 on 2020-10-14 16:05
+# Generated by Django 3.1.2 on 2020-10-21 15:51
import django.contrib.auth.models
import django.contrib.auth.validators
diff --git a/ctrack/users/tests/test_views.py b/ctrack/users/tests/test_views.py
index 525e261..e47d22b 100644
--- a/ctrack/users/tests/test_views.py
+++ b/ctrack/users/tests/test_views.py
@@ -30,7 +30,7 @@ class TestUserProfilePage:
url="http://fake.url.com",
requested_response_date="2021-01-24",
response_received_date=None,
- datetime="2020-10-10T15:00",
+ date="2020-10-10T15:00",
comments="Comments on important event",
# location is optional
user=user,