diff --git a/EquiTrack/EquiTrack/management/commands/clear-migrations-table.py b/EquiTrack/EquiTrack/management/commands/clear-migrations-table.py
new file mode 100644
index 000000000..6cf6e82b6
--- /dev/null
+++ b/EquiTrack/EquiTrack/management/commands/clear-migrations-table.py
@@ -0,0 +1,38 @@
+import logging
+
+from django.core.management import BaseCommand
+from django.db import connection, transaction
+
+from users.models import Country
+
+logger = logging.getLogger(__name__)
+
+
+class Command(BaseCommand):
+ help = 'Clear Migration Table'
+
+ def add_arguments(self, parser):
+ parser.add_argument('--schema', dest='schema')
+
+ @transaction.atomic
+ def handle(self, *args, **options):
+
+ logger.info(u'Command started')
+
+ countries = Country.objects.exclude(name__iexact='global')
+ if options['schema']:
+ countries = countries.filter(schema_name=options['schema'])
+
+ etools_apps = ','.join(["'audit'", "'activities'", "'attachments'", "'environment'", "'firms'", "'funds'",
+ "'locations'", "'hact'", "'management'", "'notification'", "'partners'", "'publics'",
+ "'purchase_order'", "'reports'", "'snapshot'", "'t2f'", "'tpm'", "'tpmpartners'",
+ "'users'", "'vision'",
+ "'trips'", "'supplies'", "'workplan'" # TODO remove these apps
+ ])
+ for country in countries:
+ connection.set_tenant(country)
+ logger.info(u'Clear table for %s' % country.name)
+ with connection.cursor() as cursor:
+ cursor.execute("DELETE FROM django_migrations WHERE app IN ({})".format(etools_apps))
+
+ logger.info(u'Command finished')
diff --git a/EquiTrack/EquiTrack/settings/base.py b/EquiTrack/EquiTrack/settings/base.py
index a9d4e081a..e5a2a2de0 100644
--- a/EquiTrack/EquiTrack/settings/base.py
+++ b/EquiTrack/EquiTrack/settings/base.py
@@ -198,11 +198,8 @@ def str2bool(value):
'reports',
'partners',
'hact',
- 'trips',
- 'supplies',
'activities',
't2f',
- 'workplan',
'attachments',
'tpm',
'audit',
diff --git a/EquiTrack/activities/migrations/0001_initial.py b/EquiTrack/activities/migrations/0001_initial.py
index 61a82d9de..583b386a6 100644
--- a/EquiTrack/activities/migrations/0001_initial.py
+++ b/EquiTrack/activities/migrations/0001_initial.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-14 07:45
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.db import migrations, models
-import django.db.models.deletion
class Migration(migrations.Migration):
@@ -11,9 +10,6 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ('partners', '0054_auto_20171013_2147'),
- ('reports', '0014_auto_20171013_2147'),
- ('locations', '0004_auto_20170112_2051'),
]
operations = [
@@ -22,10 +18,6 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateField(blank=True, null=True, verbose_name='Date')),
- ('cp_output', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Result', verbose_name='CP Output')),
- ('intervention', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.Intervention', verbose_name='Intervention')),
- ('locations', models.ManyToManyField(related_name='_activity_locations_+', to='locations.Location', verbose_name='Locations')),
- ('partner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization', verbose_name='Implementing Partner')),
],
),
]
diff --git a/EquiTrack/activities/migrations/0002_auto_20180326_1605.py b/EquiTrack/activities/migrations/0002_auto_20180326_1605.py
new file mode 100644
index 000000000..ffbbe23f5
--- /dev/null
+++ b/EquiTrack/activities/migrations/0002_auto_20180326_1605.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2018-03-26 16:05
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('activities', '0001_initial'),
+ ('locations', '0001_initial'),
+ ('reports', '0001_initial'),
+ ('partners', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='activity',
+ name='cp_output',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Result', verbose_name='CP Output'),
+ ),
+ migrations.AddField(
+ model_name='activity',
+ name='intervention',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.Intervention', verbose_name='Intervention'),
+ ),
+ migrations.AddField(
+ model_name='activity',
+ name='locations',
+ field=models.ManyToManyField(related_name='_activity_locations_+', to='locations.Location', verbose_name='Locations'),
+ ),
+ migrations.AddField(
+ model_name='activity',
+ name='partner',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization', verbose_name='Implementing Partner'),
+ ),
+ ]
diff --git a/EquiTrack/attachments/migrations/0001_initial.py b/EquiTrack/attachments/migrations/0001_initial.py
index 73869321d..218c06243 100644
--- a/EquiTrack/attachments/migrations/0001_initial.py
+++ b/EquiTrack/attachments/migrations/0001_initial.py
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-20 13:31
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
+import attachments.models
+from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
@@ -14,6 +16,7 @@ class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
@@ -23,23 +26,39 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('file', models.FileField(blank=True, null=True, upload_to='files')),
- ('hyperlink', models.CharField(blank=True, max_length=255, null=True)),
- ('object_id', models.IntegerField()),
- ('code', models.CharField(blank=True, max_length=20)),
- ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
+ ('file', models.FileField(blank=True, max_length=1024, null=True, upload_to=attachments.models.generate_file_path, verbose_name='File Attachment')),
+ ('hyperlink', models.CharField(blank=True, max_length=255, null=True, verbose_name='Hyperlink')),
+ ('object_id', models.IntegerField(verbose_name='Object ID')),
+ ('code', models.CharField(blank=True, max_length=64, verbose_name='Code')),
+ ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Content Type')),
],
options={
- 'abstract': False,
+ 'ordering': ['id'],
},
),
+ migrations.CreateModel(
+ name='AttachmentFlat',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('partner', models.CharField(blank=True, max_length=255, verbose_name='Partner')),
+ ('partner_type', models.CharField(blank=True, max_length=150, verbose_name='Partner Type')),
+ ('vendor_number', models.CharField(blank=True, max_length=50, verbose_name='Vendor Number')),
+ ('pd_ssfa_number', models.CharField(blank=True, max_length=64, verbose_name='PD SSFA Number')),
+ ('file_type', models.CharField(blank=True, max_length=100, verbose_name='File Type')),
+ ('file_link', models.CharField(blank=True, max_length=1024, verbose_name='File Link')),
+ ('uploaded_by', models.CharField(blank=True, max_length=255, verbose_name='Uploaded by')),
+ ('created', models.CharField(max_length=50, verbose_name='Created')),
+ ('attachment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='attachments.Attachment')),
+ ],
+ ),
migrations.CreateModel(
name='FileType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('order', models.PositiveIntegerField(db_index=True, editable=False)),
- ('name', models.CharField(max_length=64)),
- ('code', models.CharField(default='', max_length=64)),
+ ('name', models.CharField(max_length=64, verbose_name='Name')),
+ ('label', models.CharField(max_length=64, verbose_name='Label')),
+ ('code', models.CharField(default='', max_length=64, verbose_name='Code')),
],
options={
'ordering': ('code', 'order'),
@@ -52,6 +71,11 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='attachment',
name='file_type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='attachments.FileType'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='attachments.FileType', verbose_name='Document Type'),
+ ),
+ migrations.AddField(
+ model_name='attachment',
+ name='uploaded_by',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to=settings.AUTH_USER_MODEL, verbose_name='Uploaded By'),
),
]
diff --git a/EquiTrack/attachments/migrations/0002_auto_20170824_1319.py b/EquiTrack/attachments/migrations/0002_auto_20170824_1319.py
deleted file mode 100644
index 0d6079686..000000000
--- a/EquiTrack/attachments/migrations/0002_auto_20170824_1319.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.13 on 2017-08-24 13:19
-from __future__ import unicode_literals
-
-import attachments.models
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('attachments', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='attachment',
- options={'ordering': ['id']},
- ),
- migrations.AlterField(
- model_name='attachment',
- name='file',
- field=models.FileField(blank=True, null=True, upload_to=attachments.models.generate_file_path),
- ),
- ]
diff --git a/EquiTrack/attachments/migrations/0003_filetype_label.py b/EquiTrack/attachments/migrations/0003_filetype_label.py
deleted file mode 100644
index 187073d76..000000000
--- a/EquiTrack/attachments/migrations/0003_filetype_label.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-30 11:51
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-def set_labels(apps, schema_editor):
- FileType = apps.get_model('attachments', 'FileType')
-
- FileType.objects.update(label=models.F('name'),
- name=models.Func(models.Func(models.Func(models.F('name'), function='LOWER'),
- models.Value(' '),
- models.Value('_'),
- function='REPLACE'),
- models.Value('/'),
- models.Value('_'),
- function='REPLACE'))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('attachments', '0002_auto_20170824_1319'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='filetype',
- name='label',
- field=models.CharField(default='', max_length=64),
- preserve_default=False,
- ),
- migrations.RunPython(
- set_labels,
- migrations.RunPython.noop,
- ),
- ]
diff --git a/EquiTrack/attachments/migrations/0004_auto_20171122_1533.py b/EquiTrack/attachments/migrations/0004_auto_20171122_1533.py
deleted file mode 100644
index 5bce68b5f..000000000
--- a/EquiTrack/attachments/migrations/0004_auto_20171122_1533.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-22 15:33
-from __future__ import unicode_literals
-
-import attachments.models
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('attachments', '0003_filetype_label'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='attachment',
- name='code',
- field=models.CharField(blank=True, max_length=20, verbose_name='Code'),
- ),
- migrations.AlterField(
- model_name='attachment',
- name='file',
- field=models.FileField(blank=True, null=True, upload_to=attachments.models.generate_file_path, verbose_name='File Attachment'),
- ),
- migrations.AlterField(
- model_name='attachment',
- name='file_type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='attachments.FileType', verbose_name='Document Type'),
- ),
- migrations.AlterField(
- model_name='attachment',
- name='hyperlink',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Hyperlink'),
- ),
- migrations.AlterField(
- model_name='filetype',
- name='code',
- field=models.CharField(default='', max_length=64, verbose_name='Code'),
- ),
- migrations.AlterField(
- model_name='filetype',
- name='label',
- field=models.CharField(max_length=64, verbose_name='Label'),
- ),
- migrations.AlterField(
- model_name='filetype',
- name='name',
- field=models.CharField(max_length=64, verbose_name='Name'),
- ),
- ]
diff --git a/EquiTrack/attachments/migrations/0005_auto_20180206_1700.py b/EquiTrack/attachments/migrations/0005_auto_20180206_1700.py
deleted file mode 100644
index c61d15a33..000000000
--- a/EquiTrack/attachments/migrations/0005_auto_20180206_1700.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-02-06 17:00
-from __future__ import unicode_literals
-
-import attachments.models
-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),
- ('attachments', '0004_auto_20171122_1533'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='attachment',
- name='file',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=attachments.models.generate_file_path, verbose_name='File Attachment'),
- ),
- migrations.AlterField(
- model_name='attachment',
- name='code',
- field=models.CharField(blank=True, max_length=64, verbose_name='Code'),
- ),
- migrations.AddField(
- model_name='attachment',
- name='uploaded_by',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to=settings.AUTH_USER_MODEL, verbose_name='Uploaded By'),
- ),
- ]
diff --git a/EquiTrack/attachments/migrations/0006_attachmentflat.py b/EquiTrack/attachments/migrations/0006_attachmentflat.py
deleted file mode 100644
index b2a83d548..000000000
--- a/EquiTrack/attachments/migrations/0006_attachmentflat.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-22 10:15
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('attachments', '0005_auto_20180206_1700'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='AttachmentFlat',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('partner', models.CharField(blank=True, max_length=150)),
- ('partner_type', models.CharField(blank=True, max_length=150)),
- ('vendor_number', models.CharField(blank=True, max_length=50)),
- ('pd_ssfa_number', models.CharField(blank=True, max_length=50)),
- ('file_type', models.CharField(blank=True, max_length=100)),
- ('file_link', models.CharField(blank=True, max_length=1024)),
- ('uploaded_by', models.CharField(blank=True, max_length=255)),
- ('created', models.CharField(max_length=50)),
- ('attachment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='attachments.Attachment')),
- ],
- ),
- ]
diff --git a/EquiTrack/attachments/migrations/0007_auto_20180323_1240.py b/EquiTrack/attachments/migrations/0007_auto_20180323_1240.py
deleted file mode 100644
index ad0b57874..000000000
--- a/EquiTrack/attachments/migrations/0007_auto_20180323_1240.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-23 12:40
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('attachments', '0006_attachmentflat'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='attachmentflat',
- name='partner',
- field=models.CharField(blank=True, max_length=255),
- ),
- ]
diff --git a/EquiTrack/attachments/migrations/0008_auto_20180323_1724.py b/EquiTrack/attachments/migrations/0008_auto_20180323_1724.py
deleted file mode 100644
index f4f9ded1f..000000000
--- a/EquiTrack/attachments/migrations/0008_auto_20180323_1724.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-23 17:24
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('attachments', '0007_auto_20180323_1240'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='attachmentflat',
- name='pd_ssfa_number',
- field=models.CharField(blank=True, max_length=64),
- ),
- ]
diff --git a/EquiTrack/attachments/models.py b/EquiTrack/attachments/models.py
index e1e9cd891..ed9a98a7b 100644
--- a/EquiTrack/attachments/models.py
+++ b/EquiTrack/attachments/models.py
@@ -55,8 +55,8 @@ class Attachment(TimeStampedModel, models.Model):
)
hyperlink = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Hyperlink'))
- content_type = models.ForeignKey(ContentType)
- object_id = models.IntegerField()
+ content_type = models.ForeignKey(ContentType, verbose_name=_('Content Type'))
+ object_id = models.IntegerField(verbose_name=_('Object ID'))
content_object = GenericForeignKey()
code = models.CharField(max_length=64, blank=True, verbose_name=_('Code'))
@@ -101,14 +101,14 @@ def save(self, *args, **kwargs):
@python_2_unicode_compatible
class AttachmentFlat(models.Model):
attachment = models.ForeignKey(Attachment)
- partner = models.CharField(max_length=255, blank=True)
- partner_type = models.CharField(max_length=150, blank=True)
- vendor_number = models.CharField(max_length=50, blank=True)
- pd_ssfa_number = models.CharField(max_length=64, blank=True)
- file_type = models.CharField(max_length=100, blank=True)
- file_link = models.CharField(max_length=1024, blank=True)
- uploaded_by = models.CharField(max_length=255, blank=True)
- created = models.CharField(max_length=50)
+ partner = models.CharField(max_length=255, blank=True, verbose_name=_('Partner'))
+ partner_type = models.CharField(max_length=150, blank=True, verbose_name=_('Partner Type'))
+ vendor_number = models.CharField(max_length=50, blank=True, verbose_name=_('Vendor Number'))
+ pd_ssfa_number = models.CharField(max_length=64, blank=True, verbose_name=_('PD SSFA Number'))
+ file_type = models.CharField(max_length=100, blank=True, verbose_name=_('File Type'))
+ file_link = models.CharField(max_length=1024, blank=True, verbose_name=_('File Link'))
+ uploaded_by = models.CharField(max_length=255, blank=True, verbose_name=_('Uploaded by'))
+ created = models.CharField(max_length=50, verbose_name=_('Created'))
def __str__(self):
return six.text_type(self.attachment)
diff --git a/EquiTrack/audit/migrations/0001_initial.py b/EquiTrack/audit/migrations/0001_initial.py
index f6887d2e2..0bf6e4267 100644
--- a/EquiTrack/audit/migrations/0001_initial.py
+++ b/EquiTrack/audit/migrations/0001_initial.py
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-22 13:31
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.conf import settings
+import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
@@ -16,47 +17,10 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ('partners', '0030_intervention_signed_pd_document'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
- migrations.CreateModel(
- name='AuditorFirm',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('vendor_number', models.CharField(blank=True, max_length=30, null=True, unique=True, verbose_name='vendor number')),
- ('name', models.CharField(max_length=255, verbose_name='vendor name')),
- ('street_address', models.CharField(blank=True, max_length=500, null=True, verbose_name='address')),
- ('city', models.CharField(blank=True, max_length=255, null=True, verbose_name='city')),
- ('postal_code', models.CharField(blank=True, max_length=32, null=True, verbose_name='postal code')),
- ('country', models.CharField(blank=True, max_length=255, null=True, verbose_name='country')),
- ('email', models.CharField(blank=True, max_length=255, null=True, verbose_name='email')),
- ('phone_number', models.CharField(blank=True, max_length=32, null=True, verbose_name='phone number')),
- ('blocked', models.BooleanField(default=False, verbose_name='blocked')),
- ('hidden', models.BooleanField(default=False, verbose_name='hidden')),
- ],
- options={
- 'abstract': False,
- 'verbose_name': 'organization',
- 'verbose_name_plural': 'organizations',
- },
- ),
- migrations.CreateModel(
- name='AuditorStaffMember',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('auditor_firm', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='staff_members', to='audit.AuditorFirm', verbose_name='firm')),
- ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='audit_auditorstaffmember', to=settings.AUTH_USER_MODEL, verbose_name='user')),
- ],
- options={
- 'abstract': False,
- 'verbose_name': 'staff member',
- 'verbose_name_plural': 'staff members',
- },
- ),
migrations.CreateModel(
name='AuditPermission',
fields=[
@@ -65,7 +29,7 @@ class Migration(migrations.Migration):
('permission', models.CharField(choices=[('view', 'View'), ('edit', 'Edit'), ('action', 'Action')], max_length=10)),
('permission_type', models.CharField(choices=[('allow', 'Allow'), ('disallow', 'Disallow')], default='allow', max_length=10)),
('target', models.CharField(max_length=100)),
- ('instance_status', models.CharField(max_length=32)),
+ ('instance_status', models.CharField(max_length=32, verbose_name='Instance Status')),
],
options={
'abstract': False,
@@ -75,8 +39,8 @@ class Migration(migrations.Migration):
name='DetailedFindingInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('finding', models.TextField(verbose_name='finding')),
- ('recommendation', models.TextField(verbose_name='recommendation')),
+ ('finding', models.TextField(verbose_name='Description of Finding')),
+ ('recommendation', models.TextField(verbose_name='Recommendation and IP Management Response')),
],
),
migrations.CreateModel(
@@ -85,77 +49,91 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('status', django_fsm.FSMField(choices=[('partner_contacted', 'Partner Contacted'), ('report_submitted', 'Report Submitted'), ('final', 'Final Report'), ('canceled', 'Canceled')], default='partner_contacted', max_length=30, protected=True, verbose_name='status')),
- ('partner_contacted_at', models.DateField(blank=True, null=True, verbose_name='date partner was contacted')),
- ('type', models.CharField(choices=[('audit', 'Audit'), ('ma', 'Micro Accessment'), ('sc', 'Spot Check')], max_length=10, verbose_name='engagement type')),
- ('start_date', models.DateField(blank=True, null=True, verbose_name='period start date')),
- ('end_date', models.DateField(blank=True, null=True, verbose_name='period end date')),
+ ('status', django_fsm.FSMField(choices=[('partner_contacted', 'IP Contacted'), ('report_submitted', 'Report Submitted'), ('final', 'Final Report'), ('cancelled', 'Cancelled')], default='partner_contacted', max_length=30, protected=True, verbose_name='Status')),
+ ('partner_contacted_at', models.DateField(blank=True, null=True, verbose_name='Date IP was contacted')),
+ ('engagement_type', models.CharField(choices=[('audit', 'Audit'), ('ma', 'Micro Assessment'), ('sc', 'Spot Check'), ('sa', 'Special Audit')], max_length=10, verbose_name='Engagement Type')),
+ ('start_date', models.DateField(blank=True, null=True, verbose_name='Period Start Date')),
+ ('end_date', models.DateField(blank=True, null=True, verbose_name='Period End Date')),
('total_value', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Total value of selected FACE form(s)')),
- ('date_of_field_visit', models.DateField(blank=True, null=True, verbose_name='date of field visit')),
- ('date_of_draft_report_to_ip', models.DateField(blank=True, null=True, verbose_name='date draft report issued to IP')),
- ('date_of_comments_by_ip', models.DateField(blank=True, null=True, verbose_name='date comments received by IP')),
- ('date_of_draft_report_to_unicef', models.DateField(blank=True, null=True, verbose_name='date draft report issued to UNICEF')),
- ('date_of_comments_by_unicef', models.DateField(blank=True, null=True, verbose_name='date comments received by UNICEF')),
- ('date_of_report_submit', models.DateField(blank=True, null=True, verbose_name='date report submitted')),
- ('date_of_final_report', models.DateField(blank=True, null=True, verbose_name='date report finalized')),
- ('date_of_cancel', models.DateField(blank=True, null=True, verbose_name='date report canceled')),
- ('amount_refunded', models.IntegerField(blank=True, null=True, verbose_name='amount refunded')),
- ('additional_supporting_documentation_provided', models.IntegerField(blank=True, null=True, verbose_name='additional supporting documentation provided')),
- ('justification_provided_and_accepted', models.IntegerField(blank=True, null=True, verbose_name='justification provided and accepted')),
- ('write_off_required', models.IntegerField(blank=True, null=True, verbose_name='write off required')),
- ('pending_unsupported_amount', models.IntegerField(blank=True, null=True, verbose_name='pending unsupported amount')),
- ('cancel_comment', models.TextField(blank=True)),
+ ('date_of_field_visit', models.DateField(blank=True, null=True, verbose_name='Date of Field Visit')),
+ ('date_of_draft_report_to_ip', models.DateField(blank=True, null=True, verbose_name='Date Draft Report Issued to IP')),
+ ('date_of_comments_by_ip', models.DateField(blank=True, null=True, verbose_name='Date Comments Received from IP')),
+ ('date_of_draft_report_to_unicef', models.DateField(blank=True, null=True, verbose_name='Date Draft Report Issued to UNICEF')),
+ ('date_of_comments_by_unicef', models.DateField(blank=True, null=True, verbose_name='Date Comments Received from UNICEF')),
+ ('date_of_report_submit', models.DateField(blank=True, null=True, verbose_name='Date Report Submitted')),
+ ('date_of_final_report', models.DateField(blank=True, null=True, verbose_name='Date Report Finalized')),
+ ('date_of_cancel', models.DateField(blank=True, null=True, verbose_name='Date Report Cancelled')),
+ ('amount_refunded', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Amount Refunded')),
+ ('additional_supporting_documentation_provided', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Additional Supporting Documentation Provided')),
+ ('justification_provided_and_accepted', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Justification Provided and Accepted')),
+ ('write_off_required', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Impairment')),
('explanation_for_additional_information', models.TextField(blank=True, verbose_name='Provide explanation for additional information received from the IP or add attachments')),
+ ('joint_audit', models.BooleanField(default=False, verbose_name='Joint Audit')),
+ ('shared_ip_with', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN', 'UN'), ('UN Women', 'UN Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=20), blank=True, default=[], size=None, verbose_name='Shared IP with')),
+ ('cancel_comment', models.TextField(blank=True, verbose_name='Cancel Comment')),
],
options={
'verbose_name': 'Engagement',
'verbose_name_plural': 'Engagements',
},
),
+ migrations.CreateModel(
+ name='EngagementActionPoint',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('category', models.CharField(choices=[('Invoice and receive reimbursement of ineligible expenditure', 'Invoice and receive reimbursement of ineligible expenditure'), ('Change cash transfer modality (DCT, reimbursement or direct payment)', 'Change cash transfer modality (DCT, reimbursement or direct payment)'), ('IP to incur and report on additional expenditure', 'IP to incur and report on additional expenditure'), ('Review and amend ICE or budget', 'Review and amend ICE or budget'), ('IP to correct FACE form or Statement of Expenditure', 'IP to correct FACE form or Statement of Expenditure'), ('Schedule a programmatic visit', 'Schedule a programmatic visit'), ('Schedule a follow-up spot check', 'Schedule a follow-up spot check'), ('Schedule an audit', 'Schedule an audit'), ('Block future cash transfers', 'Block future cash transfers'), ('Block or mark vendor for deletion', 'Block or mark vendor for deletion'), ('Escalate to Chief of Operations, Dep Rep, or Rep', 'Escalate to Chief of Operations, Dep Rep, or Rep'), ('Escalate to Investigation', 'Escalate to Investigation'), ('Capacity building / Discussion with partner', 'Capacity building / Discussion with partner'), ('Change IP risk rating', 'Change IP risk rating'), ('Other', 'Other')], max_length=100, verbose_name='Category')),
+ ('description', models.TextField(blank=True, verbose_name='Description')),
+ ('due_date', models.DateField(verbose_name='Due Date')),
+ ('action_taken', models.TextField(blank=True, verbose_name='Action Taken')),
+ ('status', models.CharField(choices=[('open', 'Open'), ('closed', 'Closed')], default='open', max_length=10, verbose_name='Status')),
+ ('high_priority', models.BooleanField(default=False, verbose_name='High Priority')),
+ ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_engagement_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Author')),
+ ],
+ ),
migrations.CreateModel(
name='FinancialFinding',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('title', models.CharField(max_length=255, verbose_name='Title (Category)')),
- ('local_amount', models.IntegerField(verbose_name='Amount (local)')),
- ('amount', models.IntegerField(verbose_name='Amount (USD)')),
- ('description', models.TextField(verbose_name='description')),
- ('recommendation', models.TextField(blank=True, verbose_name='recommendation')),
- ('ip_comments', models.TextField(blank=True, verbose_name='IP comments')),
+ ('title', models.CharField(choices=[('no-supporting-documentation', 'No supporting documentation'), ('insufficient-supporting-documentation', 'Insufficient supporting documentation'), ('cut-off-error', 'Cut-off error'), ('expenditure-not-for-project-purposes', 'Expenditure not for project purposes'), ('no-proof-of-payment', 'No proof of payment'), ('no-proof-of-goods-services-received', 'No proof of goods / services received'), ('vat-incorrectly-claimed', 'VAT incorrectly claimed'), ('dsa-rates-exceeded', 'DSA rates exceeded'), ('unreasonable-price', 'Unreasonable price'), ('bank-interest-not-reported', 'Bank interest not reported'), ('support-costs-incorrectly-calculated', 'Support costs incorrectly calculated'), ('expenditure-claimed-but-activities-not-undertaken', 'Expenditure claimed but activities not undertaken'), ('advance-claimed-as-expenditure', 'Advance claimed as expenditure'), ('commitments-treated-as-expenditure', 'Commitments treated as expenditure'), ('ineligible-salary-costs', 'Ineligible salary costs'), ('ineligible-costs-other', 'Ineligible costs (other)')], max_length=255, verbose_name='Title (Category)')),
+ ('local_amount', models.DecimalField(decimal_places=2, max_digits=20, verbose_name='Amount (local)')),
+ ('amount', models.DecimalField(decimal_places=2, max_digits=20, verbose_name='Amount (USD)')),
+ ('description', models.TextField(verbose_name='Description')),
+ ('recommendation', models.TextField(blank=True, verbose_name='Recommendation')),
+ ('ip_comments', models.TextField(blank=True, verbose_name='IP Comments')),
],
+ options={
+ 'ordering': ('id',),
+ },
),
migrations.CreateModel(
name='Finding',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('priority', models.CharField(choices=[('high', 'High'), ('low', 'Low')], max_length=4, verbose_name='priority')),
- ('category_of_observation', models.CharField(choices=[('expenditure_not_for_programme_purposes', 'Expenditure not for programme purposes'), ('expenditure_claimed_but_activities_not_undertaken', 'Expenditure claimed but activities not undertaken'), ('expenditure_exceeds_the_approved_budget_rate_or_amount', 'Expenditure exceeds the approved budget rate or amount'), ('expenditure_not_recorded_in_the_correct_period_or_face_form', 'Expenditure not recorded in the correct period or FACE form'), ('advance_claimed_as_expenditure', 'Advance claimed as expenditure'), ('commitments_treated_as_expenditure', 'Commitments treated as expenditure'), ('signatories_on_face_forms_different_from_ip_agreement', 'Signatories on FACE forms different from those in the IP Agreement'), ('no_supporting_documentation', 'No supporting documentation'), ('insufficient_supporting_documentation', 'Insufficient supporting documentation'), ('no_proof_of_payment', 'No proof of payment'), ('no_proof_of_goods_received', 'No proof of goods / services received'), ('poor_record_keeping', 'Poor record keeping'), ('lack_of_audit_trail', 'Lack of audit trail (FACE forms do not reconcile with IPs and UNICEF\u2019s accounting records)'), ('lack_of_bank_reconciliations', 'Lack of bank reconciliations'), ('lack_of_segregation_of_duties', 'Lack of segregation of duties'), ('vat_incorrectly_claimed', 'VAT incorrectly claimed'), ('ineligible_salary_cost', 'Ineligible salary cost'), ('dsa_rates_exceeded', 'DSA rates exceeded'), ('support_costs_incorrectly_calculated', 'Support costs incorrectly calculated'), ('no_competitive_procedures_for_the_award_of_contracts', 'No competitive procedures for the award of contracts'), ('supplier\u2019s_invoices_not_approved', 'Supplier\u2019s invoices not approved'), ('no_evaluation_of_goods_received', 'No evaluation of goods received'), ('lack_of_procedures_for_verification_of_assets', 'Lack of procedures for verification of assets'), ('goods_/_assets_not_used_for_the_intended_purposes', 'Goods / Assets not used for the intended purposes'), ('lack_of_written_agreement_between_ip_and_sub-contractee', 'Lack of written agreement between IP and sub-contractee'), ('lack_of_sub-contractee_financial', 'Lack of sub-contractee financial / substantive progress reporting on file'), ('failure_to_implement_prior_assurance_activity_recommendations', 'Failure to implement prior assurance activity recommendations'), ('other', 'Other')], max_length=100, verbose_name='category of observation')),
- ('recommendation', models.TextField(blank=True, verbose_name='recommendation')),
- ('agreed_action_by_ip', models.TextField(blank=True, verbose_name='agreed action by IP')),
- ('deadline_of_action', models.DateField(blank=True, null=True, verbose_name='deadline of action')),
+ ('priority', models.CharField(choices=[('high', 'High'), ('low', 'Low')], max_length=4, verbose_name='Priority')),
+ ('category_of_observation', models.CharField(choices=[('expenditure_not_for_programme_purposes', 'Expenditure not for programme purposes'), ('expenditure_claimed_but_activities_not_undertaken', 'Expenditure claimed but activities not undertaken'), ('expenditure_exceeds_the_approved_budget_rate_or_amount', 'Expenditure exceeds the approved budget rate or amount'), ('expenditure_not_recorded_in_the_correct_period_or_face_form', 'Expenditure not recorded in the correct period or FACE form'), ('advance_claimed_as_expenditure', 'Advance claimed as expenditure'), ('commitments_treated_as_expenditure', 'Commitments treated as expenditure'), ('signatories_on_face_forms_different_from_ip_agreement', 'Signatories on FACE forms different from those in the IP Agreement'), ('no_supporting_documentation', 'No supporting documentation'), ('insufficient_supporting_documentation', 'Insufficient supporting documentation'), ('no_proof_of_payment', 'No proof of payment'), ('no_proof_of_goods_received', 'No proof of goods / services received'), ('poor_record_keeping', 'Poor record keeping'), ('lack_of_audit_trail', 'Lack of audit trail (FACE forms do not reconcile with IPs and UNICEF\u2019s accounting records)'), ('lack_of_bank_reconciliations', 'Lack of bank reconciliations'), ('lack_of_segregation_of_duties', 'Lack of segregation of duties'), ('vat_incorrectly_claimed', 'VAT incorrectly claimed'), ('ineligible_salary_cost', 'Ineligible salary cost'), ('dsa_rates_exceeded', 'DSA rates exceeded'), ('support_costs_incorrectly_calculated', 'Support costs incorrectly calculated'), ('no_competitive_procedures_for_the_award_of_contracts', 'No competitive procedures for the award of contracts'), ('supplier\u2019s_invoices_not_approved', 'Supplier\u2019s invoices not approved'), ('no_evaluation_of_goods_received', 'No evaluation of goods received'), ('lack_of_procedures_for_verification_of_assets', 'Lack of procedures for verification of assets'), ('goods_/_assets_not_used_for_the_intended_purposes', 'Goods / Assets not used for the intended purposes'), ('lack_of_written_agreement_between_ip_and_sub-contractee', 'Lack of written agreement between IP and sub-contractee'), ('lack_of_sub-contractee_financial', 'Lack of sub-contractee financial / substantive progress reporting on file'), ('failure_to_implement_prior_assurance_activity_recommendations', 'Failure to implement prior assurance activity recommendations'), ('other', 'Other')], max_length=100, verbose_name='Category of Observation')),
+ ('recommendation', models.TextField(blank=True, verbose_name='Recommendation')),
+ ('agreed_action_by_ip', models.TextField(blank=True, verbose_name='Agreed Action by IP')),
+ ('deadline_of_action', models.DateField(blank=True, null=True, verbose_name='Deadline of Action')),
],
),
migrations.CreateModel(
- name='PurchaseOrder',
+ name='KeyInternalControl',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('order_number', models.CharField(blank=True, max_length=30, null=True, unique=True, verbose_name='purchase order number')),
- ('contract_start_date', models.DateField(blank=True, null=True, verbose_name='contract start date')),
- ('contract_end_date', models.DateField(blank=True, null=True, verbose_name='contract end date')),
- ('auditor_firm', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='purchase_orders', to='audit.AuditorFirm', verbose_name='auditor')),
+ ('recommendation', models.TextField(blank=True, verbose_name='Recommendation')),
+ ('audit_observation', models.TextField(blank=True, verbose_name='Audit Observation')),
+ ('ip_response', models.TextField(blank=True, verbose_name='IP response')),
],
options={
- 'abstract': False,
+ 'ordering': ('id',),
},
),
migrations.CreateModel(
name='Risk',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('value', models.SmallIntegerField(blank=True, choices=[(0, 'N/A'), (1, 'Low'), (2, 'Medium'), (3, 'Significant'), (4, 'High')], null=True)),
- ('extra', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
+ ('value', models.SmallIntegerField(blank=True, choices=[(0, 'N/A'), (1, 'Low'), (2, 'Medium'), (3, 'Significant'), (4, 'High')], null=True, verbose_name='Value')),
+ ('extra', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True, verbose_name='Extra')),
],
),
migrations.CreateModel(
@@ -163,10 +141,10 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('order', models.PositiveIntegerField(db_index=True, editable=False)),
- ('weight', models.PositiveSmallIntegerField(default=1)),
- ('is_key', models.BooleanField(default=False)),
- ('header', models.TextField()),
- ('description', models.TextField(blank=True)),
+ ('weight', models.PositiveSmallIntegerField(default=1, verbose_name='Weight')),
+ ('is_key', models.BooleanField(default=False, verbose_name='Is Key')),
+ ('header', models.TextField(verbose_name='Header')),
+ ('description', models.TextField(blank=True, verbose_name='Description')),
],
options={
'ordering': ('order',),
@@ -178,31 +156,37 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('order', models.PositiveIntegerField(db_index=True, editable=False)),
- ('header', models.CharField(max_length=255)),
- ('type', models.CharField(choices=[('default', 'Default'), ('primary', 'Primary')], default='default', max_length=20)),
- ('code', models.CharField(blank=True, max_length=20)),
- ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='audit.RiskCategory')),
+ ('header', models.CharField(max_length=255, verbose_name='Header')),
+ ('category_type', models.CharField(choices=[('default', 'Default'), ('primary', 'Primary')], default='default', max_length=20, verbose_name='Category Type')),
+ ('code', models.CharField(blank=True, max_length=20, verbose_name='Code')),
+ ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='audit.RiskCategory', verbose_name='Parent')),
],
options={
- 'ordering': ('order',),
- 'abstract': False,
+ 'verbose_name_plural': 'Risk Categories',
},
),
+ migrations.CreateModel(
+ name='SpecialAuditRecommendation',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('description', models.TextField()),
+ ],
+ ),
+ migrations.CreateModel(
+ name='SpecificProcedure',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('description', models.TextField()),
+ ('finding', models.TextField(blank=True)),
+ ],
+ ),
migrations.CreateModel(
name='Audit',
fields=[
('engagement_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='audit.Engagement')),
- ('audited_expenditure', models.IntegerField(blank=True, null=True, verbose_name='Audited expenditure (USD)')),
- ('financial_findings', models.IntegerField(blank=True, null=True, verbose_name='Financial findings (USD)')),
- ('percent_of_audited_expenditure', models.IntegerField(blank=True, null=True, verbose_name='% of audited expenditure')),
- ('audit_opinion', models.CharField(blank=True, choices=[('unqualified', 'Unqualified'), ('qualified', 'Qualified'), ('disclaimer_opinion', 'Disclaimer opinion'), ('adverse_opinion', 'Adverse opinion')], max_length=20, null=True, verbose_name='audit opinion')),
- ('number_of_financial_findings', models.IntegerField(blank=True, null=True, verbose_name='number of financial findings')),
- ('high_risk', models.IntegerField(blank=True, null=True, verbose_name='high risk')),
- ('medium_risk', models.IntegerField(blank=True, null=True, verbose_name='medium risk')),
- ('low_risk', models.IntegerField(blank=True, null=True, verbose_name='low risk')),
- ('recommendation', models.TextField(blank=True, verbose_name='recommendation')),
- ('audit_observation', models.TextField(blank=True, verbose_name='audit observation')),
- ('ip_response', models.TextField(blank=True, verbose_name='IP response')),
+ ('audited_expenditure', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Audited Expenditure $')),
+ ('financial_findings', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Financial Findings $')),
+ ('audit_opinion', models.CharField(blank=True, choices=[('unqualified', 'Unqualified'), ('qualified', 'Qualified'), ('disclaimer_opinion', 'Disclaimer opinion'), ('adverse_opinion', 'Adverse opinion')], max_length=20, null=True, verbose_name='Audit Opinion')),
],
options={
'verbose_name': 'Audit',
@@ -221,13 +205,23 @@ class Migration(migrations.Migration):
},
bases=('audit.engagement',),
),
+ migrations.CreateModel(
+ name='SpecialAudit',
+ fields=[
+ ('engagement_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='audit.Engagement')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ bases=('audit.engagement',),
+ ),
migrations.CreateModel(
name='SpotCheck',
fields=[
('engagement_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='audit.Engagement')),
- ('total_amount_tested', models.IntegerField(blank=True, null=True, verbose_name='Total amount tested')),
- ('total_amount_of_ineligible_expenditure', models.IntegerField(blank=True, null=True, verbose_name='Total amount of ineligible expenditure')),
- ('internal_controls', models.TextField(blank=True, verbose_name='Internal controls')),
+ ('total_amount_tested', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Total Amount Tested')),
+ ('total_amount_of_ineligible_expenditure', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Total Amount of Ineligible Expenditure')),
+ ('internal_controls', models.TextField(blank=True, verbose_name='Internal Controls')),
],
options={
'verbose_name': 'Spot Check',
@@ -238,54 +232,26 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='riskblueprint',
name='category',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blueprints', to='audit.RiskCategory'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blueprints', to='audit.RiskCategory', verbose_name='Category'),
),
migrations.AddField(
model_name='risk',
name='blueprint',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='risks', to='audit.RiskBluePrint'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='risks', to='audit.RiskBluePrint', verbose_name='Blueprint'),
),
migrations.AddField(
model_name='risk',
name='engagement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='risks', to='audit.Engagement'),
- ),
- migrations.AddField(
- model_name='engagement',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='audit.PurchaseOrder', verbose_name='purchase order'),
- ),
- migrations.AddField(
- model_name='engagement',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization', verbose_name='partner'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='risks', to='audit.Engagement', verbose_name='Engagement'),
),
migrations.AddField(
- model_name='engagement',
- name='staff_members',
- field=models.ManyToManyField(to='audit.AuditorStaffMember', verbose_name='staff members'),
- ),
- migrations.AlterUniqueTogether(
- name='auditpermission',
- unique_together=set([('user_type', 'instance_status', 'target', 'permission_type')]),
- ),
- migrations.AlterUniqueTogether(
- name='risk',
- unique_together=set([('engagement', 'blueprint')]),
- ),
- migrations.AddField(
- model_name='finding',
- name='spot_check',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='findings', to='audit.SpotCheck', verbose_name='spot check'),
- ),
- migrations.AddField(
- model_name='financialfinding',
- name='audit',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='financial_finding_set', to='audit.Audit', verbose_name='audit'),
+ model_name='engagementactionpoint',
+ name='engagement',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_points', to='audit.Engagement', verbose_name='Engagement'),
),
migrations.AddField(
- model_name='detailedfindinginfo',
- name='micro_assesment',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='findings', to='audit.MicroAssessment', verbose_name='micro assessment'),
+ model_name='engagementactionpoint',
+ name='person_responsible',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='engagement_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Person Responsible'),
),
]
diff --git a/EquiTrack/audit/migrations/0002_auto_20170622_1331.py b/EquiTrack/audit/migrations/0002_auto_20170622_1331.py
deleted file mode 100644
index fece5cafe..000000000
--- a/EquiTrack/audit/migrations/0002_auto_20170622_1331.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-22 13:31
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def create_email_template(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
-
- EmailTemplate.objects.get_or_create(name='audit/engagement/submit_to_auditor')
- EmailTemplate.objects.get_or_create(name='audit/engagement/reported_by_auditor')
- EmailTemplate.objects.get_or_create(name='audit/staff_member/appointed_to_engagement')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0001_initial'),
- ('post_office', '0004_auto_20160607_0901'),
- ]
-
- operations = [
- migrations.RunPython(create_email_template, migrations.RunPython.noop),
- ]
diff --git a/EquiTrack/audit/migrations/0002_auto_20180326_1605.py b/EquiTrack/audit/migrations/0002_auto_20180326_1605.py
new file mode 100644
index 000000000..ace4abd7f
--- /dev/null
+++ b/EquiTrack/audit/migrations/0002_auto_20180326_1605.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2018-03-26 16:05
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('purchase_order', '0001_initial'),
+ ('audit', '0001_initial'),
+ ('partners', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='engagement',
+ name='active_pd',
+ field=models.ManyToManyField(to='partners.Intervention', verbose_name='Active PDs'),
+ ),
+ migrations.AddField(
+ model_name='engagement',
+ name='agreement',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='purchase_order.PurchaseOrder', verbose_name='Purchase Order'),
+ ),
+ migrations.AddField(
+ model_name='engagement',
+ name='authorized_officers',
+ field=models.ManyToManyField(blank=True, related_name='engagement_authorizations', to='partners.PartnerStaffMember', verbose_name='Authorized Officers'),
+ ),
+ migrations.AddField(
+ model_name='engagement',
+ name='partner',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization', verbose_name='Partner'),
+ ),
+ migrations.AddField(
+ model_name='engagement',
+ name='po_item',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='purchase_order.PurchaseOrderItem', verbose_name='PO Item Number'),
+ ),
+ migrations.AddField(
+ model_name='engagement',
+ name='staff_members',
+ field=models.ManyToManyField(to='purchase_order.AuditorStaffMember', verbose_name='Staff Members'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='auditpermission',
+ unique_together=set([('user_type', 'instance_status', 'target', 'permission_type')]),
+ ),
+ migrations.AddField(
+ model_name='specificprocedure',
+ name='audit',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='specific_procedures', to='audit.SpecialAudit', verbose_name='Special Audit'),
+ ),
+ migrations.AddField(
+ model_name='specialauditrecommendation',
+ name='audit',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='other_recommendations', to='audit.SpecialAudit', verbose_name='Special Audit'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='risk',
+ unique_together=set([('engagement', 'blueprint')]),
+ ),
+ migrations.AddField(
+ model_name='keyinternalcontrol',
+ name='audit',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='key_internal_controls', to='audit.Audit', verbose_name='Audit'),
+ ),
+ migrations.AddField(
+ model_name='finding',
+ name='spot_check',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='findings', to='audit.SpotCheck', verbose_name='Spot Check'),
+ ),
+ migrations.AddField(
+ model_name='financialfinding',
+ name='audit',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='financial_finding_set', to='audit.Audit', verbose_name='Audit'),
+ ),
+ migrations.AddField(
+ model_name='detailedfindinginfo',
+ name='micro_assesment',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='findings', to='audit.MicroAssessment', verbose_name='Micro Assessment'),
+ ),
+ ]
diff --git a/EquiTrack/audit/migrations/0003_auto_20170627_1129.py b/EquiTrack/audit/migrations/0003_auto_20170627_1129.py
deleted file mode 100644
index 3fbcdc535..000000000
--- a/EquiTrack/audit/migrations/0003_auto_20170627_1129.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-27 11:29
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0004_engagement_active_pd'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='purchaseorder',
- name='contract_end_date',
- field=models.DateField(blank=True, null=True, verbose_name='Contract Expiry Date'),
- ),
- migrations.AlterField(
- model_name='purchaseorder',
- name='contract_start_date',
- field=models.DateField(blank=True, null=True, verbose_name='PO Date'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0003_auto_20170630_0602.py b/EquiTrack/audit/migrations/0003_auto_20170630_0602.py
deleted file mode 100644
index 0bb5bd824..000000000
--- a/EquiTrack/audit/migrations/0003_auto_20170630_0602.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-30 06:02
-from __future__ import unicode_literals
-
-import django.core.validators
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0002_auto_20170622_1331'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='audit',
- name='percent_of_audited_expenditure',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(0.0), django.core.validators.MaxValueValidator(100.0)], verbose_name='% of audited expenditure'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0004_engagement_active_pd.py b/EquiTrack/audit/migrations/0004_engagement_active_pd.py
deleted file mode 100644
index ce4bebec9..000000000
--- a/EquiTrack/audit/migrations/0004_engagement_active_pd.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-30 13:03
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0030_intervention_signed_pd_document'),
- ('audit', '0003_auto_20170630_0602'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='engagement',
- name='active_pd',
- field=models.ManyToManyField(to='partners.Intervention', verbose_name='Active PDs'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0006_auto_20170807_1156.py b/EquiTrack/audit/migrations/0006_auto_20170807_1156.py
deleted file mode 100644
index 0e16e7ed2..000000000
--- a/EquiTrack/audit/migrations/0006_auto_20170807_1156.py
+++ /dev/null
@@ -1,140 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-08-07 11:56
-from __future__ import unicode_literals
-
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-import django_fsm
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0046_auto_20170714_1844'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('audit', '0003_auto_20170627_1129'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='EngagementActionPoint',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('description', models.CharField(choices=[('Invoice and recieve reimbursement of ineligible expenditure', 'Invoice and recieve reimbursement of ineligible expenditure'), ('Change cash transfer modality (DCT, reimbursement or direct payment)', 'Change cash transfer modality (DCT, reimbursement or direct payment)'), ('IP to incur and report on additional expenditure', 'IP to incur and report on additional expenditure'), ('Review and amend ICE or budget', 'Review and amend ICE or budget'), ('IP to correct FACE form or Statement of Expenditure', 'IP to correct FACE form or Statement of Expenditure'), ('Schedule a programmatic visit', 'Schedule a programmatic visit'), ('Schedule a follow-up spot check', 'Schedule a follow-up spot check'), ('Schedule an audit', 'Schedule an audit'), ('Block future cash transfers', 'Block future cash transfers'), ('Block or mark vendor for deletion', 'Block or mark vendor for deletion'), ('Escalate to Chief of Operations, Dep Rep, or Rep', 'Escalate to Chief of Operations, Dep Rep, or Rep'), ('Escalate to Investigation', 'Escalate to Investigation'), ('Capacity building / Discussion with partner', 'Capacity building / Discussion with partner'), ('Other', 'Other')], max_length=100)),
- ('due_date', models.DateField()),
- ('comments', models.TextField()),
- ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_engagement_action_points', to=settings.AUTH_USER_MODEL)),
- ],
- ),
- migrations.RenameField(
- model_name='riskcategory',
- old_name='type',
- new_name='category_type',
- ),
- migrations.RenameField(
- model_name='engagement',
- old_name='type',
- new_name='engagement_type'
- ),
- migrations.RemoveField(
- model_name='audit',
- name='high_risk',
- ),
- migrations.RemoveField(
- model_name='audit',
- name='low_risk',
- ),
- migrations.RemoveField(
- model_name='audit',
- name='medium_risk',
- ),
- migrations.RemoveField(
- model_name='audit',
- name='number_of_financial_findings',
- ),
- migrations.RemoveField(
- model_name='engagement',
- name='pending_unsupported_amount',
- ),
- migrations.AddField(
- model_name='engagement',
- name='authorized_officers',
- field=models.ManyToManyField(blank=True, related_name='engagement_authorizations', to='partners.PartnerStaffMember'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='engagement_type',
- field=models.CharField(choices=[('audit', 'Audit'), ('ma', 'Micro Accessment'), ('sc', 'Spot Check')], max_length=10, verbose_name='Engagement type'),
- ),
- migrations.AlterField(
- model_name='audit',
- name='audited_expenditure',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Audited expenditure (USD)'),
- ),
- migrations.AlterField(
- model_name='audit',
- name='financial_findings',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Financial findings (USD)'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='additional_supporting_documentation_provided',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='additional supporting documentation provided'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='amount_refunded',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='amount refunded'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_cancel',
- field=models.DateField(blank=True, null=True, verbose_name='date report cancelled'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='justification_provided_and_accepted',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='justification provided and accepted'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='status',
- field=django_fsm.FSMField(choices=[('partner_contacted', 'Partner Contacted'), ('report_submitted', 'Report Submitted'), ('final', 'Final Report'), ('cancelled', 'Cancelled')], default='partner_contacted', max_length=30, protected=True, verbose_name='status'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='write_off_required',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='write off required'),
- ),
- migrations.AlterField(
- model_name='financialfinding',
- name='amount',
- field=models.DecimalField(decimal_places=2, max_digits=20, verbose_name='Amount (USD)'),
- ),
- migrations.AlterField(
- model_name='financialfinding',
- name='local_amount',
- field=models.DecimalField(decimal_places=2, max_digits=20, verbose_name='Amount (local)'),
- ),
- migrations.AlterField(
- model_name='spotcheck',
- name='total_amount_of_ineligible_expenditure',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Total amount of ineligible expenditure'),
- ),
- migrations.AlterField(
- model_name='spotcheck',
- name='total_amount_tested',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Total amount tested'),
- ),
- migrations.AddField(
- model_name='engagementactionpoint',
- name='engagement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_points', to='audit.Engagement'),
- ),
- migrations.AddField(
- model_name='engagementactionpoint',
- name='person_responsible',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='engagement_action_points', to=settings.AUTH_USER_MODEL),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0007_auto_20170807_1158.py b/EquiTrack/audit/migrations/0007_auto_20170807_1158.py
deleted file mode 100644
index 668b836ca..000000000
--- a/EquiTrack/audit/migrations/0007_auto_20170807_1158.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-08-07 11:58
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def create_email_templates(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
- EmailTemplate.objects.get_or_create(name='audit/engagement/action_point_assigned')
-
-
-def migrate_cancelled_status(apps, schema_editor):
- Engagement = apps.get_model('audit', 'Engagement')
- Engagement.objects.filter(status='canceled').update(status='cancelled')
-
-
-def revert_migrate_cancelled_status(apps, schema_editor):
- Engagement = apps.get_model('audit', 'Engagement')
- Engagement.objects.filter(status='cancelled').update(status='canceled')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0006_auto_20170807_1156'),
- ]
-
- operations = [
- migrations.RunPython(create_email_templates, migrations.RunPython.noop),
- migrations.RunPython(migrate_cancelled_status, revert_migrate_cancelled_status),
- ]
diff --git a/EquiTrack/audit/migrations/0008_auto_20170921_1045.py b/EquiTrack/audit/migrations/0008_auto_20170921_1045.py
deleted file mode 100644
index 910bfa8d3..000000000
--- a/EquiTrack/audit/migrations/0008_auto_20170921_1045.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.13 on 2017-09-21 10:45
-from __future__ import unicode_literals
-
-import django_fsm
-from django.db import migrations, models
-
-
-def update_action_points_choices(apps, schema_editor):
- apps.get_model('audit', 'EngagementActionPoint').objects\
- .filter(description='Invoice and recieve reimbursement of ineligible expenditure')\
- .update(description='Invoice and receive reimbursement of ineligible expenditure')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0007_auto_20170807_1158'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='engagement',
- name='date_of_cancel',
- field=models.DateField(blank=True, null=True, verbose_name='Date report cancelled'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_comments_by_ip',
- field=models.DateField(blank=True, null=True, verbose_name='Date comments received from IP'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_comments_by_unicef',
- field=models.DateField(blank=True, null=True, verbose_name='Date comments received from UNICEF'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_draft_report_to_ip',
- field=models.DateField(blank=True, null=True, verbose_name='Date draft report issued to IP'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_draft_report_to_unicef',
- field=models.DateField(blank=True, null=True, verbose_name='Date draft report issued to UNICEF'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_field_visit',
- field=models.DateField(blank=True, null=True, verbose_name='Date of field visit'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_final_report',
- field=models.DateField(blank=True, null=True, verbose_name='Date report finalized'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_report_submit',
- field=models.DateField(blank=True, null=True, verbose_name='Date report submitted'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='partner_contacted_at',
- field=models.DateField(blank=True, null=True, verbose_name='Date IP was contacted'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='status',
- field=django_fsm.FSMField(choices=[('partner_contacted', 'IP Contacted'), ('report_submitted', 'Report Submitted'), ('final', 'Final Report'), ('cancelled', 'Cancelled')], default='partner_contacted', max_length=30, protected=True, verbose_name='status'),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='description',
- field=models.CharField(choices=[('Invoice and receive reimbursement of ineligible expenditure', 'Invoice and receive reimbursement of ineligible expenditure'), ('Change cash transfer modality (DCT, reimbursement or direct payment)', 'Change cash transfer modality (DCT, reimbursement or direct payment)'), ('IP to incur and report on additional expenditure', 'IP to incur and report on additional expenditure'), ('Review and amend ICE or budget', 'Review and amend ICE or budget'), ('IP to correct FACE form or Statement of Expenditure', 'IP to correct FACE form or Statement of Expenditure'), ('Schedule a programmatic visit', 'Schedule a programmatic visit'), ('Schedule a follow-up spot check', 'Schedule a follow-up spot check'), ('Schedule an audit', 'Schedule an audit'), ('Block future cash transfers', 'Block future cash transfers'), ('Block or mark vendor for deletion', 'Block or mark vendor for deletion'), ('Escalate to Chief of Operations, Dep Rep, or Rep', 'Escalate to Chief of Operations, Dep Rep, or Rep'), ('Escalate to Investigation', 'Escalate to Investigation'), ('Capacity building / Discussion with partner', 'Capacity building / Discussion with partner'), ('Other', 'Other')], max_length=100),
- ),
- migrations.RunPython(update_action_points_choices, migrations.RunPython.noop),
- ]
diff --git a/EquiTrack/audit/migrations/0009_purchaseorder_item_number.py b/EquiTrack/audit/migrations/0009_purchaseorder_item_number.py
deleted file mode 100644
index 05bff1124..000000000
--- a/EquiTrack/audit/migrations/0009_purchaseorder_item_number.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.13 on 2017-09-28 12:47
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0008_auto_20170921_1045'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='purchaseorder',
- name='item_number',
- field=models.IntegerField(blank=True, null=True, verbose_name='PO Item Number'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0010_auto_20171016_1003.py b/EquiTrack/audit/migrations/0010_auto_20171016_1003.py
deleted file mode 100644
index 325d68b5d..000000000
--- a/EquiTrack/audit/migrations/0010_auto_20171016_1003.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-16 10:03
-from __future__ import unicode_literals
-
-import json
-
-from django.db import migrations
-from django.utils import six
-
-
-def unwrap_risks_extra(apps, schema_editor):
- Risk = apps.get_model('audit', 'Risk')
- for risk in Risk.objects.filter(extra__isnull=False):
- if not isinstance(risk.extra, six.string_types):
- continue
-
- risk.extra = json.loads(risk.extra)
- risk.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0009_purchaseorder_item_number'),
- ]
-
- operations = [
- migrations.RunPython(unwrap_risks_extra, migrations.RunPython.noop)
- ]
diff --git a/EquiTrack/audit/migrations/0011_auto_20171017_0947.py b/EquiTrack/audit/migrations/0011_auto_20171017_0947.py
deleted file mode 100644
index 0b56e8350..000000000
--- a/EquiTrack/audit/migrations/0011_auto_20171017_0947.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-17 09:47
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0010_auto_20171016_1003'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='engagement',
- name='joint_audit',
- field=models.BooleanField(default=False, verbose_name='Joint Audit'),
- ),
- migrations.AddField(
- model_name='engagement',
- name='shared_ip_with',
- field=models.CharField(blank=True, choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN Women', 'UN Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=12, verbose_name='Shared IP with'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0012_auto_20171017_1239.py b/EquiTrack/audit/migrations/0012_auto_20171017_1239.py
deleted file mode 100644
index ec01eeca5..000000000
--- a/EquiTrack/audit/migrations/0012_auto_20171017_1239.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-17 12:39
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0011_auto_20171017_0947'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='SpecialAudit',
- fields=[
- ('engagement_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='audit.Engagement')),
- ],
- options={
- 'abstract': False,
- },
- bases=('audit.engagement',),
- ),
- migrations.CreateModel(
- name='SpecialAuditRecommendation',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('number', models.PositiveIntegerField()),
- ('description', models.TextField()),
- ('audit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='other_recommendations', to='audit.SpecialAudit', verbose_name='Special Audit')),
- ],
- ),
- migrations.CreateModel(
- name='SpecificProcedure',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('number', models.PositiveIntegerField()),
- ('description', models.TextField()),
- ('finding', models.TextField()),
- ('audit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='specific_procedures', to='audit.SpecialAudit', verbose_name='Special Audit')),
- ],
- ),
- migrations.AlterField(
- model_name='engagement',
- name='engagement_type',
- field=models.CharField(choices=[('audit', 'Audit'), ('ma', 'Micro Accessment'), ('sc', 'Spot Check'), ('sa', 'Special Audit')], max_length=10, verbose_name='Engagement type'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0013_auto_20171018_1345.py b/EquiTrack/audit/migrations/0013_auto_20171018_1345.py
deleted file mode 100644
index a818f4617..000000000
--- a/EquiTrack/audit/migrations/0013_auto_20171018_1345.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-19 12:33
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0012_auto_20171017_1239'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='engagement',
- name='engagement_type',
- field=models.CharField(
- choices=[('audit', 'Audit'), ('ma', 'Micro Accessment'), ('sc', 'Spot Check'), ('sa', 'Special Audit')],
- max_length=10, verbose_name='Engagement type'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0014_auto_20171020_0849.py b/EquiTrack/audit/migrations/0014_auto_20171020_0849.py
deleted file mode 100644
index 34c7ba7de..000000000
--- a/EquiTrack/audit/migrations/0014_auto_20171020_0849.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-20 08:49
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0013_auto_20171018_1345'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='specialauditrecommendation',
- name='number',
- ),
- migrations.RemoveField(
- model_name='specificprocedure',
- name='number',
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0015_auto_20171020_1319.py b/EquiTrack/audit/migrations/0015_auto_20171020_1319.py
deleted file mode 100644
index 7aabf8153..000000000
--- a/EquiTrack/audit/migrations/0015_auto_20171020_1319.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-20 13:19
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0014_auto_20171020_0849'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='specificprocedure',
- name='finding',
- field=models.TextField(blank=True),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0016_auto_20171025_0842.py b/EquiTrack/audit/migrations/0016_auto_20171025_0842.py
deleted file mode 100644
index 7bc05cd1a..000000000
--- a/EquiTrack/audit/migrations/0016_auto_20171025_0842.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-25 08:42
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0015_auto_20171020_1319'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='engagement',
- name='engagement_type',
- field=models.CharField(choices=[('audit', 'Audit'), ('ma', 'Micro Assessment'), ('sc', 'Spot Check'), ('sa', 'Special Audit')], max_length=10, verbose_name='Engagement type'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0017_auto_20171031_1256.py b/EquiTrack/audit/migrations/0017_auto_20171031_1256.py
deleted file mode 100644
index 53020910c..000000000
--- a/EquiTrack/audit/migrations/0017_auto_20171031_1256.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-31 12:56
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-def migrate_numbers(apps, schema_editor):
- Engagement = apps.get_model('audit', 'Engagement')
- PurchaseOrder = apps.get_model('audit', 'PurchaseOrder')
- PurchaseOrderItem = apps.get_model('audit', 'PurchaseOrderItem')
-
- numbers = {}
- for po in PurchaseOrder.objects.all():
- if po.item_number:
- numbers[po.id] = PurchaseOrderItem.objects.create(purchase_order=po, number=po.item_number)
-
- for engagement in Engagement.objects.select_related('agreement'):
- po = engagement.agreement
- po_item = numbers.get(po.id, None)
-
- if po_item:
- engagement.po_item = po_item
- engagement.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0016_auto_20171025_0842'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='PurchaseOrderItem',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('number', models.IntegerField(verbose_name='PO Item Number')),
- ],
- ),
- migrations.AddField(
- model_name='purchaseorderitem',
- name='purchase_order',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='audit.PurchaseOrder'),
- ),
- migrations.AlterUniqueTogether(
- name='purchaseorderitem',
- unique_together=set([('purchase_order', 'number')]),
- ),
- migrations.AddField(
- model_name='engagement',
- name='po_item',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='audit.PurchaseOrderItem', verbose_name='PO Item Number'),
- ),
- migrations.RunPython(
- migrate_numbers,
- migrations.RunPython.noop,
- ),
- migrations.RemoveField(
- model_name='purchaseorder',
- name='item_number',
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0018_auto_20171113_1009.py b/EquiTrack/audit/migrations/0018_auto_20171113_1009.py
deleted file mode 100644
index 69aa995b2..000000000
--- a/EquiTrack/audit/migrations/0018_auto_20171113_1009.py
+++ /dev/null
@@ -1,423 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-13 10:09
-from __future__ import unicode_literals
-
-from django.conf import settings
-import django.contrib.postgres.fields.jsonb
-import django.core.validators
-from django.db import migrations, models
-import django.db.models.deletion
-import django_fsm
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0017_auto_20171031_1256'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='engagement',
- name='shared_ip_with',
- field=models.CharField(blank=True, choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN', 'UN'), ('UN Women', 'UN Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=20, verbose_name='Shared IP with'),
- ),
- migrations.AlterModelOptions(
- name='auditorfirm',
- options={'verbose_name': 'Organization', 'verbose_name_plural': 'Organizations'},
- ),
- migrations.AlterModelOptions(
- name='auditorstaffmember',
- options={'verbose_name': 'Staff Member', 'verbose_name_plural': 'Staff Members'},
- ),
- migrations.AlterField(
- model_name='audit',
- name='audit_observation',
- field=models.TextField(blank=True, verbose_name='Audit Observation'),
- ),
- migrations.AlterField(
- model_name='audit',
- name='audit_opinion',
- field=models.CharField(blank=True, choices=[('unqualified', 'Unqualified'), ('qualified', 'Qualified'), ('disclaimer_opinion', 'Disclaimer opinion'), ('adverse_opinion', 'Adverse opinion')], max_length=20, null=True, verbose_name='Audit Opinion'),
- ),
- migrations.AlterField(
- model_name='audit',
- name='audited_expenditure',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Audited Expenditure $'),
- ),
- migrations.AlterField(
- model_name='audit',
- name='financial_findings',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Financial Findings $'),
- ),
- migrations.AlterField(
- model_name='audit',
- name='percent_of_audited_expenditure',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(0.0), django.core.validators.MaxValueValidator(100.0)], verbose_name='% Of Audited Expenditure'),
- ),
- migrations.AlterField(
- model_name='audit',
- name='recommendation',
- field=models.TextField(blank=True, verbose_name='Recommendation'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='blocked',
- field=models.BooleanField(default=False, verbose_name='Blocked'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='city',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='City'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='country',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Country'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='email',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Email'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='hidden',
- field=models.BooleanField(default=False, verbose_name='Hidden'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='name',
- field=models.CharField(max_length=255, verbose_name='Vendor Name'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='phone_number',
- field=models.CharField(blank=True, max_length=32, null=True, verbose_name='Phone Number'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='postal_code',
- field=models.CharField(blank=True, max_length=32, null=True, verbose_name='Postal Code'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='street_address',
- field=models.CharField(blank=True, max_length=500, null=True, verbose_name='Address'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='vendor_number',
- field=models.CharField(blank=True, max_length=30, null=True, unique=True, verbose_name='Vendor Number'),
- ),
- migrations.AlterField(
- model_name='auditorstaffmember',
- name='auditor_firm',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='staff_members', to='audit.AuditorFirm', verbose_name='Auditor'),
- ),
- migrations.AlterField(
- model_name='auditorstaffmember',
- name='user',
- field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='audit_auditorstaffmember', to=settings.AUTH_USER_MODEL, verbose_name='User'),
- ),
- migrations.AlterField(
- model_name='detailedfindinginfo',
- name='finding',
- field=models.TextField(verbose_name='Description of Finding'),
- ),
- migrations.AlterField(
- model_name='detailedfindinginfo',
- name='micro_assesment',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='findings', to='audit.MicroAssessment', verbose_name='Micro Assessment'),
- ),
- migrations.AlterField(
- model_name='detailedfindinginfo',
- name='recommendation',
- field=models.TextField(verbose_name='Recommendation and IP Management Response'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='additional_supporting_documentation_provided',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Additional Supporting Documentation Provided'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='audit.PurchaseOrder', verbose_name='Purchase Order'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='amount_refunded',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Amount Refunded'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='authorized_officers',
- field=models.ManyToManyField(blank=True, related_name='engagement_authorizations', to='partners.PartnerStaffMember', verbose_name='Authorized Officers'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='cancel_comment',
- field=models.TextField(blank=True, verbose_name='Cancel Comment'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_cancel',
- field=models.DateField(blank=True, null=True, verbose_name='Date Report Cancelled'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_comments_by_ip',
- field=models.DateField(blank=True, null=True, verbose_name='Date Comments Received from IP'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_comments_by_unicef',
- field=models.DateField(blank=True, null=True, verbose_name='Date Comments Received from UNICEF'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_draft_report_to_ip',
- field=models.DateField(blank=True, null=True, verbose_name='Date Draft Report Issued to IP'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_draft_report_to_unicef',
- field=models.DateField(blank=True, null=True, verbose_name='Date Draft Report Issued to UNICEF'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_field_visit',
- field=models.DateField(blank=True, null=True, verbose_name='Date of Field Visit'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_final_report',
- field=models.DateField(blank=True, null=True, verbose_name='Date Report Finalized'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='date_of_report_submit',
- field=models.DateField(blank=True, null=True, verbose_name='Date Report Submitted'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='end_date',
- field=models.DateField(blank=True, null=True, verbose_name='Period End Date'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='engagement_type',
- field=models.CharField(choices=[('audit', 'Audit'), ('ma', 'Micro Assessment'), ('sc', 'Spot Check'), ('sa', 'Special Audit')], max_length=10, verbose_name='Engagement Type'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='justification_provided_and_accepted',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Justification Provided and Accepted'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization', verbose_name='Partner'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='staff_members',
- field=models.ManyToManyField(to='audit.AuditorStaffMember', verbose_name='Staff Members'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='start_date',
- field=models.DateField(blank=True, null=True, verbose_name='Period Start Date'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='status',
- field=django_fsm.FSMField(choices=[('partner_contacted', 'IP Contacted'), ('report_submitted', 'Report Submitted'), ('final', 'Final Report'), ('cancelled', 'Cancelled')], default='partner_contacted', max_length=30, protected=True, verbose_name='Status'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='write_off_required',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Write Off Required '),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='author',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_engagement_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Author'),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='comments',
- field=models.TextField(verbose_name='Comments'),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='description',
- field=models.CharField(choices=[('Invoice and receive reimbursement of ineligible expenditure', 'Invoice and receive reimbursement of ineligible expenditure'), ('Change cash transfer modality (DCT, reimbursement or direct payment)', 'Change cash transfer modality (DCT, reimbursement or direct payment)'), ('IP to incur and report on additional expenditure', 'IP to incur and report on additional expenditure'), ('Review and amend ICE or budget', 'Review and amend ICE or budget'), ('IP to correct FACE form or Statement of Expenditure', 'IP to correct FACE form or Statement of Expenditure'), ('Schedule a programmatic visit', 'Schedule a programmatic visit'), ('Schedule a follow-up spot check', 'Schedule a follow-up spot check'), ('Schedule an audit', 'Schedule an audit'), ('Block future cash transfers', 'Block future cash transfers'), ('Block or mark vendor for deletion', 'Block or mark vendor for deletion'), ('Escalate to Chief of Operations, Dep Rep, or Rep', 'Escalate to Chief of Operations, Dep Rep, or Rep'), ('Escalate to Investigation', 'Escalate to Investigation'), ('Capacity building / Discussion with partner', 'Capacity building / Discussion with partner'), ('Other', 'Other')], max_length=100, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='due_date',
- field=models.DateField(verbose_name='Due Date'),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='engagement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_points', to='audit.Engagement', verbose_name='Engagement'),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='person_responsible',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='engagement_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Person Responsible'),
- ),
- migrations.AlterField(
- model_name='financialfinding',
- name='audit',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='financial_finding_set', to='audit.Audit', verbose_name='Audit'),
- ),
- migrations.AlterField(
- model_name='financialfinding',
- name='description',
- field=models.TextField(verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='financialfinding',
- name='ip_comments',
- field=models.TextField(blank=True, verbose_name='IP Comments'),
- ),
- migrations.AlterField(
- model_name='financialfinding',
- name='recommendation',
- field=models.TextField(blank=True, verbose_name='Recommendation'),
- ),
- migrations.AlterField(
- model_name='finding',
- name='agreed_action_by_ip',
- field=models.TextField(blank=True, verbose_name='Agreed Action by IP'),
- ),
- migrations.AlterField(
- model_name='finding',
- name='category_of_observation',
- field=models.CharField(choices=[('expenditure_not_for_programme_purposes', 'Expenditure not for programme purposes'), ('expenditure_claimed_but_activities_not_undertaken', 'Expenditure claimed but activities not undertaken'), ('expenditure_exceeds_the_approved_budget_rate_or_amount', 'Expenditure exceeds the approved budget rate or amount'), ('expenditure_not_recorded_in_the_correct_period_or_face_form', 'Expenditure not recorded in the correct period or FACE form'), ('advance_claimed_as_expenditure', 'Advance claimed as expenditure'), ('commitments_treated_as_expenditure', 'Commitments treated as expenditure'), ('signatories_on_face_forms_different_from_ip_agreement', 'Signatories on FACE forms different from those in the IP Agreement'), ('no_supporting_documentation', 'No supporting documentation'), ('insufficient_supporting_documentation', 'Insufficient supporting documentation'), ('no_proof_of_payment', 'No proof of payment'), ('no_proof_of_goods_received', 'No proof of goods / services received'), ('poor_record_keeping', 'Poor record keeping'), ('lack_of_audit_trail', 'Lack of audit trail (FACE forms do not reconcile with IPs and UNICEF\u2019s accounting records)'), ('lack_of_bank_reconciliations', 'Lack of bank reconciliations'), ('lack_of_segregation_of_duties', 'Lack of segregation of duties'), ('vat_incorrectly_claimed', 'VAT incorrectly claimed'), ('ineligible_salary_cost', 'Ineligible salary cost'), ('dsa_rates_exceeded', 'DSA rates exceeded'), ('support_costs_incorrectly_calculated', 'Support costs incorrectly calculated'), ('no_competitive_procedures_for_the_award_of_contracts', 'No competitive procedures for the award of contracts'), ('supplier\u2019s_invoices_not_approved', 'Supplier\u2019s invoices not approved'), ('no_evaluation_of_goods_received', 'No evaluation of goods received'), ('lack_of_procedures_for_verification_of_assets', 'Lack of procedures for verification of assets'), ('goods_/_assets_not_used_for_the_intended_purposes', 'Goods / Assets not used for the intended purposes'), ('lack_of_written_agreement_between_ip_and_sub-contractee', 'Lack of written agreement between IP and sub-contractee'), ('lack_of_sub-contractee_financial', 'Lack of sub-contractee financial / substantive progress reporting on file'), ('failure_to_implement_prior_assurance_activity_recommendations', 'Failure to implement prior assurance activity recommendations'), ('other', 'Other')], max_length=100, verbose_name='Category of Observation'),
- ),
- migrations.AlterField(
- model_name='finding',
- name='deadline_of_action',
- field=models.DateField(blank=True, null=True, verbose_name='Deadline of Action'),
- ),
- migrations.AlterField(
- model_name='finding',
- name='priority',
- field=models.CharField(choices=[('high', 'High'), ('low', 'Low')], max_length=4, verbose_name='Priority'),
- ),
- migrations.AlterField(
- model_name='finding',
- name='recommendation',
- field=models.TextField(blank=True, verbose_name='Recommendation'),
- ),
- migrations.AlterField(
- model_name='finding',
- name='spot_check',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='findings', to='audit.SpotCheck', verbose_name='Spot Check'),
- ),
- migrations.AlterField(
- model_name='purchaseorder',
- name='auditor_firm',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='purchase_orders', to='audit.AuditorFirm', verbose_name='Auditor'),
- ),
- migrations.AlterField(
- model_name='purchaseorder',
- name='order_number',
- field=models.CharField(blank=True, max_length=30, null=True, unique=True, verbose_name='Purchase Order Number'),
- ),
- migrations.AlterField(
- model_name='purchaseorderitem',
- name='purchase_order',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='audit.PurchaseOrder', verbose_name='Purchase Order'),
- ),
- migrations.AlterField(
- model_name='risk',
- name='blueprint',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='risks', to='audit.RiskBluePrint', verbose_name='Blueprint'),
- ),
- migrations.AlterField(
- model_name='risk',
- name='engagement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='risks', to='audit.Engagement', verbose_name='Engagement'),
- ),
- migrations.AlterField(
- model_name='risk',
- name='extra',
- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True, verbose_name='Extra'),
- ),
- migrations.AlterField(
- model_name='risk',
- name='value',
- field=models.SmallIntegerField(blank=True, choices=[(0, 'N/A'), (1, 'Low'), (2, 'Medium'), (3, 'Significant'), (4, 'High')], null=True, verbose_name='Value'),
- ),
- migrations.AlterField(
- model_name='riskblueprint',
- name='category',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blueprints', to='audit.RiskCategory', verbose_name='Category'),
- ),
- migrations.AlterField(
- model_name='riskblueprint',
- name='description',
- field=models.TextField(blank=True, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='riskblueprint',
- name='header',
- field=models.TextField(verbose_name='Header'),
- ),
- migrations.AlterField(
- model_name='riskblueprint',
- name='is_key',
- field=models.BooleanField(default=False, verbose_name='Is Key'),
- ),
- migrations.AlterField(
- model_name='riskblueprint',
- name='weight',
- field=models.PositiveSmallIntegerField(default=1, verbose_name='Weight'),
- ),
- migrations.AlterField(
- model_name='riskcategory',
- name='category_type',
- field=models.CharField(choices=[('default', 'Default'), ('primary', 'Primary')], default='default', max_length=20, verbose_name='Category Type'),
- ),
- migrations.AlterField(
- model_name='riskcategory',
- name='code',
- field=models.CharField(blank=True, max_length=20, verbose_name='Code'),
- ),
- migrations.AlterField(
- model_name='riskcategory',
- name='header',
- field=models.CharField(max_length=255, verbose_name='Header'),
- ),
- migrations.AlterField(
- model_name='riskcategory',
- name='parent',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='audit.RiskCategory', verbose_name='Parent'),
- ),
- migrations.AlterField(
- model_name='spotcheck',
- name='total_amount_of_ineligible_expenditure',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Total Amount of Ineligible Expenditure'),
- ),
- migrations.AlterField(
- model_name='spotcheck',
- name='total_amount_tested',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Total Amount Tested'),
- ),
- migrations.AlterField(
- model_name='spotcheck',
- name='internal_controls',
- field=models.TextField(blank=True, verbose_name='Internal Controls'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='write_off_required',
- field=models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True, verbose_name='Impairment'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0019_auto_20171113_1150.py b/EquiTrack/audit/migrations/0019_auto_20171113_1150.py
deleted file mode 100644
index 939a30020..000000000
--- a/EquiTrack/audit/migrations/0019_auto_20171113_1150.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-13 11:50
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0018_auto_20171113_1009'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='auditorfirm',
- name='deleted_flag',
- field=models.BooleanField(default=False, verbose_name='Marked For Deletion in VISION'),
- ),
- migrations.AddField(
- model_name='auditorfirm',
- name='vision_synced',
- field=models.BooleanField(default=False, verbose_name='Synced from VISION'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0020_auto_20171205_1305.py b/EquiTrack/audit/migrations/0020_auto_20171205_1305.py
deleted file mode 100644
index de98b7c32..000000000
--- a/EquiTrack/audit/migrations/0020_auto_20171205_1305.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-05 13:05
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def migrate_purchase_order(apps, schema_editor):
- TargetAuditorFirm = apps.get_model('purchase_order', 'AuditorFirm')
- TargetAuditorStaffMember = apps.get_model('purchase_order', 'AuditorStaffMember')
- TargetPurchaseOrder = apps.get_model('purchase_order', 'PurchaseOrder')
- TargetPurchaseOrderItem = apps.get_model('purchase_order', 'PurchaseOrderItem')
-
- SourceAuditorFirm = apps.get_model('audit', 'AuditorFirm')
- SourceAuditorStaffMember = apps.get_model('audit', 'AuditorStaffMember')
- SourcePurchaseOrder = apps.get_model('audit', 'PurchaseOrder')
- SourcePurchaseOrderItem = apps.get_model('audit', 'PurchaseOrderItem')
-
- firms = dict()
- for firm in SourceAuditorFirm.objects.all():
- if TargetAuditorFirm.objects.filter(vendor_number=firm.vendor_number).exists():
- firm = TargetAuditorFirm.objects.get(vendor_number=firm.vendor_number)
-
- else:
- firm .__class__ = TargetAuditorFirm
- firm.id = None
- firm.save()
-
- firms[firm.vendor_number] = firm
-
- for staff_member in SourceAuditorStaffMember.objects.select_related('auditor_firm'):
- if not TargetAuditorStaffMember.objects.filter(user_id=staff_member.user_id).exists():
- staff_member.__class__ = TargetAuditorStaffMember
- staff_member.id = None
- staff_member.auditor_firm = firms[staff_member.auditor_firm.vendor_number]
- staff_member.save()
-
- purchase_orders = dict()
- for purchase_order in SourcePurchaseOrder.objects.select_related('auditor_firm'):
- if TargetPurchaseOrder.objects.filter(order_number=purchase_order.order_number).exists():
- purchase_order = TargetPurchaseOrder.objects.get(order_number=purchase_order.order_number)
-
- else:
- purchase_order.__class__ = TargetPurchaseOrder
- purchase_order.id = None
- purchase_order.auditor_firm = firms[purchase_order.auditor_firm.vendor_number]
- purchase_order.save()
-
- purchase_orders[purchase_order.order_number] = purchase_order
-
- for po_item in SourcePurchaseOrderItem.objects.select_related('purchase_order'):
- if not TargetPurchaseOrderItem.objects.filter(
- purchase_order__order_number=po_item.purchase_order.order_number,
- number=po_item.number).exists():
- po_item.__class__ = TargetPurchaseOrderItem
- po_item.id = None
- po_item.purchase_order = purchase_orders[po_item.purchase_order.order_number]
- po_item.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0019_auto_20171113_1150'),
- ('purchase_order', '0002_auto_20180111_0808'),
- ]
-
- operations = [
- migrations.RunPython(
- migrate_purchase_order,
- migrations.RunPython.noop,
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0021_auto_20171206_1103.py b/EquiTrack/audit/migrations/0021_auto_20171206_1103.py
deleted file mode 100644
index efc0fac46..000000000
--- a/EquiTrack/audit/migrations/0021_auto_20171206_1103.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-06 11:03
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0020_auto_20171205_1305'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='engagement',
- name='agreement1',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='purchase_order.PurchaseOrder', verbose_name='Purchase Order'),
- ),
- migrations.AddField(
- model_name='engagement',
- name='staff_members1',
- field=models.ManyToManyField(null=True, to='purchase_order.AuditorStaffMember', verbose_name='Staff Members'),
- ),
- migrations.AddField(
- model_name='engagement',
- name='po_item1',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='purchase_order.PurchaseOrderItem', verbose_name='PO Item Number'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0022_auto_20171206_1103.py b/EquiTrack/audit/migrations/0022_auto_20171206_1103.py
deleted file mode 100644
index e2301e00c..000000000
--- a/EquiTrack/audit/migrations/0022_auto_20171206_1103.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-06 11:03
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-def migrate_agreement(apps, schema_editor):
- Engagement = apps.get_model('audit', 'Engagement')
- TargetPurchaseOrder = apps.get_model('purchase_order', 'PurchaseOrder')
-
- purchase_order_cache = dict()
- for engagement in Engagement.objects.select_related('agreement'):
-
- purchase_order = purchase_order_cache.get(engagement.agreement.order_number, None)
- if purchase_order is None:
- purchase_order = TargetPurchaseOrder.objects.get(order_number=engagement.agreement.order_number)
- purchase_order_cache[purchase_order.order_number] = purchase_order
-
- engagement.agreement1 = purchase_order
- engagement.save()
-
-
-def migrate_staff_members(apps, schema_editor):
- Engagement = apps.get_model('audit', 'Engagement')
- TargetAuditorStaffMember = apps.get_model('purchase_order', 'AuditorStaffMember')
-
- staff_member_cache = dict()
- for engagement in Engagement.objects.prefetch_related('staff_members', 'staff_members__user'):
-
- staff_members = []
- for staff_member in engagement.staff_members.all():
-
- new_staff_member = staff_member_cache.get(staff_member.user.email, None)
- if new_staff_member is None:
- new_staff_member = TargetAuditorStaffMember.objects.get(user__email=staff_member.user.email)
- staff_member_cache[new_staff_member.user.email] = new_staff_member
-
- staff_members.append(new_staff_member)
-
- engagement.staff_members1 = staff_members
-
-
-def migrate_po_item(apps, schema_editor):
- Engagement = apps.get_model('audit', 'Engagement')
- TargetPOItem = apps.get_model('purchase_order', 'PurchaseOrderItem')
-
- po_item_cache = dict()
- for engagement in Engagement.objects.select_related('po_item', 'po_item__purchase_order'):
- if not engagement.po_item:
- continue
-
- key = {
- 'purchase_order__order_number': engagement.po_item.purchase_order.order_number,
- 'number': engagement.po_item.number,
- }
- po_item = po_item_cache.get(tuple(key.values()), None)
- if po_item is None:
- po_item = TargetPOItem.objects.get(**key)
- po_item_cache[tuple(key.values())] = po_item
-
- engagement.po_item1 = po_item
- engagement.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0021_auto_20171206_1103'),
- ]
-
- operations = [
- migrations.RunPython(
- migrate_agreement,
- ),
- migrations.RunPython(
- migrate_staff_members,
- ),
- migrations.RunPython(
- migrate_po_item,
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0023_auto_20171206_1122.py b/EquiTrack/audit/migrations/0023_auto_20171206_1122.py
deleted file mode 100644
index fc4ffd757..000000000
--- a/EquiTrack/audit/migrations/0023_auto_20171206_1122.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-06 11:22
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0022_auto_20171206_1103'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='auditorstaffmember',
- name='auditor_firm',
- ),
- migrations.RemoveField(
- model_name='auditorstaffmember',
- name='user',
- ),
- migrations.RemoveField(
- model_name='purchaseorder',
- name='auditor_firm',
- ),
- migrations.AlterUniqueTogether(
- name='purchaseorderitem',
- unique_together=set([]),
- ),
- migrations.RemoveField(
- model_name='purchaseorderitem',
- name='purchase_order',
- ),
- migrations.RemoveField(
- model_name='engagement',
- name='agreement',
- ),
- migrations.RemoveField(
- model_name='engagement',
- name='po_item',
- ),
- migrations.RemoveField(
- model_name='engagement',
- name='staff_members',
- ),
- migrations.DeleteModel(
- name='AuditorFirm',
- ),
- migrations.DeleteModel(
- name='AuditorStaffMember',
- ),
- migrations.DeleteModel(
- name='PurchaseOrder',
- ),
- migrations.DeleteModel(
- name='PurchaseOrderItem',
- ),
- migrations.RenameField(
- model_name='engagement',
- old_name='agreement1',
- new_name='agreement',
- ),
- migrations.RenameField(
- model_name='engagement',
- old_name='po_item1',
- new_name='po_item',
- ),
- migrations.RenameField(
- model_name='engagement',
- old_name='staff_members1',
- new_name='staff_members',
- ),
- migrations.AlterField(
- model_name='engagement',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='purchase_order.PurchaseOrder',
- verbose_name='Purchase Order'),
- ),
- migrations.AlterField(
- model_name='engagement',
- name='staff_members',
- field=models.ManyToManyField(to='purchase_order.AuditorStaffMember', verbose_name='Staff Members'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0024_auto_20180119_0840.py b/EquiTrack/audit/migrations/0024_auto_20180119_0840.py
deleted file mode 100644
index ae27cab7c..000000000
--- a/EquiTrack/audit/migrations/0024_auto_20180119_0840.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-19 08:40
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-def migrate_shared_ip_with(apps, schema_editor):
- Engagement = apps.get_model('audit', 'engagement')
- for engagement in Engagement.objects.exclude(shared_ip_with1=''):
- engagement.shared_ip_with = [engagement.shared_ip_with1]
- engagement.save()
-
-
-def migrate_shared_ip_with_backwards(apps, schema_editor):
- Engagement = apps.get_model('audit', 'engagement')
- for engagement in Engagement.objects.exclude(shared_ip_with=[]):
- engagement.shared_ip_with1 = engagement.shared_ip_with[0]
- engagement.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0023_auto_20171206_1122'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='engagement',
- old_name='shared_ip_with',
- new_name='shared_ip_with1'
- ),
- migrations.AddField(
- model_name='engagement',
- name='shared_ip_with',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN', 'UN'), ('UN Women', 'UN Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=20), blank=True, default=[], size=None, verbose_name='Shared IP with'),
- ),
- migrations.RunPython(migrate_shared_ip_with, migrate_shared_ip_with_backwards)
- ]
diff --git a/EquiTrack/audit/migrations/0025_auto_20180119_0852.py b/EquiTrack/audit/migrations/0025_auto_20180119_0852.py
deleted file mode 100644
index f3ed29276..000000000
--- a/EquiTrack/audit/migrations/0025_auto_20180119_0852.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-19 08:52
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0024_auto_20180119_0840'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='engagement',
- name='shared_ip_with1'
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0026_auto_20180119_1413.py b/EquiTrack/audit/migrations/0026_auto_20180119_1413.py
deleted file mode 100644
index cb208dd7b..000000000
--- a/EquiTrack/audit/migrations/0026_auto_20180119_1413.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-19 14:13
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0025_auto_20180119_0852'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='financialfinding',
- name='title',
- field=models.CharField(choices=[('no-supporting-documentation', 'No supporting documentation'), ('insufficient-supporting-documentation', 'Insufficient supporting documentation'), ('cut-off-error', 'Cut-off error'), ('expenditure-not-for-project-purposes', 'Expenditure not for project purposes'), ('no-proof-of-payment', 'No proof of payment'), ('no-proof-of-goods-services-received', 'No proof of goods / services received'), ('vat-incorrectly-claimed', 'VAT incorrectly claimed'), ('dsa-rates-exceeded', 'DSA rates exceeded'), ('unreasonable-price', 'Unreasonable price'), ('bank-interest-not-reported', 'Bank interest not reported'), ('support-costs-incorrectly-calculated', 'Support costs incorrectly calculated'), ('expenditure-claimed-but-activities-not-undertaken', 'Expenditure claimed but activities not undertaken'), ('advance-claimed-as-expenditure', 'Advance claimed as expenditure'), ('commitments-treated-as-expenditure', 'Commitments treated as expenditure'), ('ineligible-salary-costs', 'Ineligible salary costs'), ('ineligible-costs-other', 'Ineligible costs (other)')], max_length=255, verbose_name='Title (Category)'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0027_remove_audit_percent_of_audited_expenditure.py b/EquiTrack/audit/migrations/0027_remove_audit_percent_of_audited_expenditure.py
deleted file mode 100644
index 52f1cd81f..000000000
--- a/EquiTrack/audit/migrations/0027_remove_audit_percent_of_audited_expenditure.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-19 14:55
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0026_auto_20180119_1413'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='audit',
- name='percent_of_audited_expenditure',
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0028_auto_20180120_0718.py b/EquiTrack/audit/migrations/0028_auto_20180120_0718.py
deleted file mode 100644
index d23ad2bf4..000000000
--- a/EquiTrack/audit/migrations/0028_auto_20180120_0718.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-20 07:18
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0027_remove_audit_percent_of_audited_expenditure'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='engagementactionpoint',
- old_name='description',
- new_name='category',
- ),
- migrations.RenameField(
- model_name='engagementactionpoint',
- old_name='comments',
- new_name='description',
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='category',
- field=models.CharField(choices=[('Invoice and receive reimbursement of ineligible expenditure', 'Invoice and receive reimbursement of ineligible expenditure'), ('Change cash transfer modality (DCT, reimbursement or direct payment)', 'Change cash transfer modality (DCT, reimbursement or direct payment)'), ('IP to incur and report on additional expenditure', 'IP to incur and report on additional expenditure'), ('Review and amend ICE or budget', 'Review and amend ICE or budget'), ('IP to correct FACE form or Statement of Expenditure', 'IP to correct FACE form or Statement of Expenditure'), ('Schedule a programmatic visit', 'Schedule a programmatic visit'), ('Schedule a follow-up spot check', 'Schedule a follow-up spot check'), ('Schedule an audit', 'Schedule an audit'), ('Block future cash transfers', 'Block future cash transfers'), ('Block or mark vendor for deletion', 'Block or mark vendor for deletion'), ('Escalate to Chief of Operations, Dep Rep, or Rep', 'Escalate to Chief of Operations, Dep Rep, or Rep'), ('Escalate to Investigation', 'Escalate to Investigation'), ('Capacity building / Discussion with partner', 'Capacity building / Discussion with partner'), ('Change IP risk rating', 'Change IP risk rating'), ('Other', 'Other')], max_length=100, verbose_name='Category'),
- ),
- migrations.AlterField(
- model_name='engagementactionpoint',
- name='description',
- field=models.TextField(blank=True, verbose_name='Description'),
- ),
- migrations.AddField(
- model_name='engagementactionpoint',
- name='action_taken',
- field=models.TextField(blank=True, verbose_name='Action Taken'),
- ),
- migrations.AddField(
- model_name='engagementactionpoint',
- name='status',
- field=models.CharField(choices=[('open', 'Open'), ('closed', 'Closed')], default='open', max_length=10, verbose_name='Status'),
- ),
- migrations.AddField(
- model_name='engagementactionpoint',
- name='high_priority',
- field=models.BooleanField(default=False, verbose_name='High Priority'),
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0029_auto_20180124_0934.py b/EquiTrack/audit/migrations/0029_auto_20180124_0934.py
deleted file mode 100644
index 8694816e9..000000000
--- a/EquiTrack/audit/migrations/0029_auto_20180124_0934.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-24 09:34
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-def migrate_keyinternalcontrols(apps, schema_editor):
- Audit = apps.get_model('audit', 'Audit')
- KeyInternalControl = apps.get_model('audit', 'KeyInternalControl')
-
- for audit in Audit.objects.filter(~models.Q(recommendation='') | ~models.Q(audit_observation='') | ~models.Q(ip_response='')):
- KeyInternalControl.objects.create(
- audit=audit,
- recommendation=audit.recommendation,
- audit_observation=audit.audit_observation,
- ip_response=audit.ip_response,
- )
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0028_auto_20180120_0718'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='KeyInternalControl',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('recommendation', models.TextField(blank=True, verbose_name='Recommendation')),
- ('audit_observation', models.TextField(blank=True, verbose_name='Audit Observation')),
- ('ip_response', models.TextField(blank=True, verbose_name='IP response')),
- ],
- options={
- 'ordering': ('id',),
- },
- ),
- migrations.AlterModelOptions(
- name='financialfinding',
- options={'ordering': ('id',)},
- ),
- migrations.AddField(
- model_name='keyinternalcontrol',
- name='audit',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='key_internal_controls', to='audit.Audit', verbose_name='Audit'),
- ),
- migrations.RunPython(migrate_keyinternalcontrols, migrations.RunPython.noop),
- migrations.RemoveField(
- model_name='audit',
- name='audit_observation',
- ),
- migrations.RemoveField(
- model_name='audit',
- name='ip_response',
- ),
- migrations.RemoveField(
- model_name='audit',
- name='recommendation',
- ),
- ]
diff --git a/EquiTrack/audit/migrations/0030_auto_20180219_1402.py b/EquiTrack/audit/migrations/0030_auto_20180219_1402.py
deleted file mode 100644
index ff26dfabf..000000000
--- a/EquiTrack/audit/migrations/0030_auto_20180219_1402.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-02-19 14:02
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def create_email_template(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
-
- EmailTemplate.objects.get_or_create(name='audit/staff_member/invite')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0029_auto_20180124_0934'),
- ('post_office', '0004_auto_20160607_0901'),
- ]
-
- operations = [
- migrations.RunPython(create_email_template, migrations.RunPython.noop),
- ]
diff --git a/EquiTrack/audit/migrations/0031_auto_20180309_1210.py b/EquiTrack/audit/migrations/0031_auto_20180309_1210.py
deleted file mode 100644
index e51df7ce7..000000000
--- a/EquiTrack/audit/migrations/0031_auto_20180309_1210.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-09 12:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('audit', '0030_auto_20180219_1402'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='riskcategory',
- options={'verbose_name_plural': 'Risk Categories'},
- ),
- ]
diff --git a/EquiTrack/audit/purchase_order/migrations/0001_initial.py b/EquiTrack/audit/purchase_order/migrations/0001_initial.py
index ed3cdd793..524a06684 100644
--- a/EquiTrack/audit/purchase_order/migrations/0001_initial.py
+++ b/EquiTrack/audit/purchase_order/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-05 12:49
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.conf import settings
@@ -32,8 +32,10 @@ class Migration(migrations.Migration):
('country', models.CharField(blank=True, max_length=255, null=True, verbose_name='Country')),
('email', models.CharField(blank=True, max_length=255, null=True, verbose_name='Email')),
('phone_number', models.CharField(blank=True, max_length=32, null=True, verbose_name='Phone Number')),
- ('blocked', models.BooleanField(default=False, verbose_name='Blocked')),
+ ('vision_synced', models.BooleanField(default=False, verbose_name='Synced from VISION')),
+ ('blocked', models.BooleanField(default=False, verbose_name='Blocked in VISION')),
('hidden', models.BooleanField(default=False, verbose_name='Hidden')),
+ ('deleted_flag', models.BooleanField(default=False, verbose_name='Marked For Deletion in VISION')),
],
options={
'abstract': False,
diff --git a/EquiTrack/audit/purchase_order/migrations/0002_auto_20180111_0808.py b/EquiTrack/audit/purchase_order/migrations/0002_auto_20180111_0808.py
deleted file mode 100644
index 133f05aa0..000000000
--- a/EquiTrack/audit/purchase_order/migrations/0002_auto_20180111_0808.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-11 08:08
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('purchase_order', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='auditorfirm',
- name='deleted_flag',
- field=models.BooleanField(default=False, verbose_name='Marked For Deletion in VISION'),
- ),
- migrations.AddField(
- model_name='auditorfirm',
- name='vision_synced',
- field=models.BooleanField(default=False, verbose_name='Synced from VISION'),
- ),
- migrations.AlterField(
- model_name='auditorfirm',
- name='blocked',
- field=models.BooleanField(default=False, verbose_name='Blocked in VISION'),
- ),
- ]
diff --git a/EquiTrack/audit/tests/test_models.py b/EquiTrack/audit/tests/test_models.py
index 2278607ee..3ab20430d 100644
--- a/EquiTrack/audit/tests/test_models.py
+++ b/EquiTrack/audit/tests/test_models.py
@@ -6,6 +6,7 @@
from django.core import mail
from django.core.exceptions import ValidationError
+from django.core.management import call_command
from django.db import connection
from django.utils import six
@@ -50,6 +51,11 @@ def test_signal(self):
class EngagementStaffMemberTestCase(BaseTenantTestCase):
+
+ @classmethod
+ def setUpTestData(cls):
+ call_command('update_notifications')
+
def test_signal(self):
auditor_firm = AuditPartnerFactory()
staff_member = auditor_firm.staff_members.first()
diff --git a/EquiTrack/environment/migrations/0001_initial.py b/EquiTrack/environment/migrations/0001_initial.py
index ee88ff242..d4bd68989 100644
--- a/EquiTrack/environment/migrations/0001_initial.py
+++ b/EquiTrack/environment/migrations/0001_initial.py
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-10 10:53
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
+from django.conf import settings
from django.db import migrations, models
+import django.utils.timezone
class Migration(migrations.Migration):
@@ -10,6 +12,9 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
+ ('auth', '0008_alter_user_username_max_length'),
+ ('users', '0001_initial'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
@@ -17,8 +22,47 @@ class Migration(migrations.Migration):
name='IssueCheckConfig',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('check_id', models.CharField(db_index=True, max_length=100, unique=True)),
- ('is_active', models.BooleanField(default=False)),
+ ('check_id', models.CharField(db_index=True, max_length=100, unique=True, verbose_name='Check id')),
+ ('is_active', models.BooleanField(default=False, verbose_name='Is Active')),
],
),
+ migrations.CreateModel(
+ name='TenantFlag',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(help_text='The human/computer readable name.', max_length=100, unique=True, verbose_name='Name')),
+ ('everyone', models.NullBooleanField(help_text='Flip this flag on (Yes) or off (No) for everyone, overriding all other settings. Leave as Unknown to use normally.', verbose_name='Everyone')),
+ ('percent', models.DecimalField(blank=True, decimal_places=1, help_text='A number between 0.0 and 99.9 to indicate a percentage of users for whom this flag will be active.', max_digits=3, null=True, verbose_name='Percent')),
+ ('testing', models.BooleanField(default=False, help_text='Allow this flag to be set for a session for user testing.', verbose_name='Testing')),
+ ('superusers', models.BooleanField(default=True, help_text='Flag always active for superusers?', verbose_name='Superusers')),
+ ('staff', models.BooleanField(default=False, help_text='Flag always active for staff?', verbose_name='Staff')),
+ ('authenticated', models.BooleanField(default=False, help_text='Flag always active for authenticate users?', verbose_name='Authenticated')),
+ ('languages', models.TextField(blank=True, default='', help_text='Activate this flag for users with one of these languages (comma separated list)', verbose_name='Languages')),
+ ('rollout', models.BooleanField(default=False, help_text='Activate roll-out mode?', verbose_name='Rollout')),
+ ('note', models.TextField(blank=True, help_text='Note where this Flag is used.', verbose_name='Note')),
+ ('created', models.DateTimeField(db_index=True, default=django.utils.timezone.now, help_text='Date when this Flag was created.', verbose_name='Created')),
+ ('modified', models.DateTimeField(default=django.utils.timezone.now, help_text='Date when this Flag was last modified.', verbose_name='Modified')),
+ ('countries', models.ManyToManyField(blank=True, help_text='Activate this flag for these countries.', to='users.Country', verbose_name='Countries')),
+ ('groups', models.ManyToManyField(blank=True, help_text='Activate this flag for these user groups.', to='auth.Group', verbose_name='Users')),
+ ('users', models.ManyToManyField(blank=True, help_text='Activate this flag for these users.', to=settings.AUTH_USER_MODEL, verbose_name='Users')),
+ ],
+ options={
+ 'verbose_name_plural': 'Flags',
+ },
+ ),
+ migrations.CreateModel(
+ name='TenantSwitch',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(help_text='The human/computer readable name.', max_length=100, unique=True, verbose_name='Name')),
+ ('active', models.BooleanField(default=False, help_text='Is this switch active?', verbose_name='Active')),
+ ('note', models.TextField(blank=True, help_text='Note where this Switch is used.', verbose_name='Note')),
+ ('created', models.DateTimeField(db_index=True, default=django.utils.timezone.now, help_text='Date when this Switch was created.', verbose_name='Created')),
+ ('modified', models.DateTimeField(default=django.utils.timezone.now, help_text='Date when this Switch was last modified.', verbose_name='Modified')),
+ ('countries', models.ManyToManyField(blank=True, help_text='Activate this switch for these countries.', to='users.Country', verbose_name='Countries')),
+ ],
+ options={
+ 'verbose_name_plural': 'Switches',
+ },
+ ),
]
diff --git a/EquiTrack/environment/migrations/0002_tenantflag.py b/EquiTrack/environment/migrations/0002_tenantflag.py
deleted file mode 100644
index 6088835be..000000000
--- a/EquiTrack/environment/migrations/0002_tenantflag.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-30 17:01
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('waffle', '0002_auto_20161201_0958'),
- ('users', '0009_remove_userprofile_installation_id'),
- ('environment', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='TenantFlag',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('countries', models.ManyToManyField(blank=True, help_text='Activate this flag for these countries.', to='users.Country')),
- ('flag', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='waffle.Flag')),
- ],
- ),
- ]
diff --git a/EquiTrack/environment/migrations/0003_tenantswitch.py b/EquiTrack/environment/migrations/0003_tenantswitch.py
deleted file mode 100644
index 8868d5478..000000000
--- a/EquiTrack/environment/migrations/0003_tenantswitch.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-11 19:57
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('waffle', '0002_auto_20161201_0958'),
- ('users', '0010_auto_20171127_2158'),
- ('environment', '0002_tenantflag'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='TenantSwitch',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('countries', models.ManyToManyField(blank=True, help_text='Activate this switch for these countries.', to='users.Country')),
- ('switch', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='waffle.Switch')),
- ],
- ),
- ]
diff --git a/EquiTrack/environment/migrations/0004_auto_20171214_2204.py b/EquiTrack/environment/migrations/0004_auto_20171214_2204.py
deleted file mode 100644
index 290b8c8b0..000000000
--- a/EquiTrack/environment/migrations/0004_auto_20171214_2204.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-14 22:04
-from __future__ import unicode_literals
-
-import datetime
-from django.db import migrations, models
-import django.utils.timezone
-from django.utils.timezone import utc
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('environment', '0003_tenantswitch'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='tenantswitch',
- options={'verbose_name_plural': 'Switches'},
- ),
- migrations.RemoveField(
- model_name='tenantswitch',
- name='switch',
- ),
- migrations.AddField(
- model_name='tenantswitch',
- name='active',
- field=models.BooleanField(default=False, help_text='Is this switch active?'),
- ),
- migrations.AddField(
- model_name='tenantswitch',
- name='created',
- field=models.DateTimeField(db_index=True, default=django.utils.timezone.now, help_text='Date when this Switch was created.'),
- ),
- migrations.AddField(
- model_name='tenantswitch',
- name='modified',
- field=models.DateTimeField(default=django.utils.timezone.now, help_text='Date when this Switch was last modified.'),
- ),
- migrations.AddField(
- model_name='tenantswitch',
- name='name',
- field=models.CharField(default=datetime.datetime(2017, 12, 14, 22, 4, 20, 651783, tzinfo=utc), help_text='The human/computer readable name.', max_length=100, unique=True),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='tenantswitch',
- name='note',
- field=models.TextField(blank=True, help_text='Note where this Switch is used.'),
- ),
- ]
diff --git a/EquiTrack/environment/migrations/0005_auto_20171222_1929.py b/EquiTrack/environment/migrations/0005_auto_20171222_1929.py
deleted file mode 100644
index 8ab72bb5d..000000000
--- a/EquiTrack/environment/migrations/0005_auto_20171222_1929.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-22 19:29
-from __future__ import unicode_literals
-
-from django.conf import settings
-from django.db import migrations, models
-import django.utils.timezone
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('auth', '0007_alter_validators_add_error_messages'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('environment', '0004_auto_20171214_2204'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='tenantflag',
- options={'verbose_name_plural': 'Flags'},
- ),
- migrations.RemoveField(
- model_name='tenantflag',
- name='flag',
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='authenticated',
- field=models.BooleanField(default=False, help_text='Flag always active for authenticate users?'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='created',
- field=models.DateTimeField(db_index=True, default=django.utils.timezone.now, help_text='Date when this Flag was created.'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='everyone',
- field=models.NullBooleanField(help_text='Flip this flag on (Yes) or off (No) for everyone, overriding all other settings. Leave as Unknown to use normally.'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='groups',
- field=models.ManyToManyField(blank=True, help_text='Activate this flag for these user groups.', to='auth.Group'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='languages',
- field=models.TextField(blank=True, default='', help_text='Activate this flag for users with one of these languages (comma separated list)'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='modified',
- field=models.DateTimeField(default=django.utils.timezone.now, help_text='Date when this Flag was last modified.'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='name',
- field=models.CharField(default='tenantflag-dummy-placeholder 2017-12-22 19:29:07.968162+00:00', help_text='The human/computer readable name.', max_length=100, unique=True),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='note',
- field=models.TextField(blank=True, help_text='Note where this Flag is used.'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='percent',
- field=models.DecimalField(blank=True, decimal_places=1, help_text='A number between 0.0 and 99.9 to indicate a percentage of users for whom this flag will be active.', max_digits=3, null=True),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='rollout',
- field=models.BooleanField(default=False, help_text='Activate roll-out mode?'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='staff',
- field=models.BooleanField(default=False, help_text='Flag always active for staff?'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='superusers',
- field=models.BooleanField(default=True, help_text='Flag always active for superusers?'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='testing',
- field=models.BooleanField(default=False, help_text='Allow this flag to be set for a session for user testing.'),
- ),
- migrations.AddField(
- model_name='tenantflag',
- name='users',
- field=models.ManyToManyField(blank=True, help_text='Activate this flag for these users.', to=settings.AUTH_USER_MODEL),
- ),
- ]
diff --git a/EquiTrack/environment/models.py b/EquiTrack/environment/models.py
index 89d1f2b84..732a4b106 100644
--- a/EquiTrack/environment/models.py
+++ b/EquiTrack/environment/models.py
@@ -1,16 +1,18 @@
from __future__ import absolute_import, division, print_function, unicode_literals
-from decimal import Decimal
import random
+from decimal import Decimal
from django.conf import settings
from django.contrib.auth.models import Group
from django.db import connection, models
-from django.utils.encoding import python_2_unicode_compatible
from django.utils import six, timezone
-from waffle.models import BaseModel, CACHE_EMPTY, set_flag
+from django.utils.encoding import python_2_unicode_compatible
+from django.utils.translation import ugettext as _
+
from waffle import managers
-from waffle.utils import get_setting, keyfmt, get_cache
+from waffle.models import BaseModel, CACHE_EMPTY, set_flag
+from waffle.utils import get_cache, get_setting, keyfmt
from users.models import Country
@@ -22,8 +24,8 @@ class IssueCheckConfig(models.Model):
"""
Used to enable/disable issue checks at runtime.
"""
- check_id = models.CharField(max_length=100, unique=True, db_index=True)
- is_active = models.BooleanField(default=False)
+ check_id = models.CharField(max_length=100, unique=True, db_index=True, verbose_name=_('Check id'))
+ is_active = models.BooleanField(default=False, verbose_name=_('Is Active'))
def __str__(self):
return '{}: {}'.format(self.check_id, self.is_active)
@@ -36,38 +38,38 @@ class TenantFlag(BaseModel):
'countries' is the only field we add. All other fields are copy/pasted from waffle.Flag.
"""
- name = models.CharField(max_length=100, unique=True, help_text=(
+ name = models.CharField(max_length=100, unique=True, verbose_name=_('Name'), help_text=(
'The human/computer readable name.'))
- countries = models.ManyToManyField(Country, blank=True, help_text=(
+ countries = models.ManyToManyField(Country, blank=True, verbose_name=_('Countries'), help_text=(
'Activate this flag for these countries.'))
- everyone = models.NullBooleanField(blank=True, help_text=(
+ everyone = models.NullBooleanField(blank=True, verbose_name=_('Everyone'), help_text=(
'Flip this flag on (Yes) or off (No) for everyone, overriding all '
'other settings. Leave as Unknown to use normally.'))
- percent = models.DecimalField(max_digits=3, decimal_places=1, null=True, blank=True, help_text=(
- 'A number between 0.0 and 99.9 to indicate a percentage of users for '
- 'whom this flag will be active.'))
- testing = models.BooleanField(default=False, help_text=(
+ percent = models.DecimalField(max_digits=3, decimal_places=1, null=True, blank=True, verbose_name=_('Percent'),
+ help_text=('A number between 0.0 and 99.9 to indicate a percentage of users for '
+ 'whom this flag will be active.'))
+ testing = models.BooleanField(default=False, verbose_name=_('Testing'), help_text=(
'Allow this flag to be set for a session for user testing.'))
- superusers = models.BooleanField(default=True, help_text=(
+ superusers = models.BooleanField(default=True, verbose_name=_('Superusers'), help_text=(
'Flag always active for superusers?'))
- staff = models.BooleanField(default=False, help_text=(
+ staff = models.BooleanField(default=False, verbose_name=_('Staff'), help_text=(
'Flag always active for staff?'))
- authenticated = models.BooleanField(default=False, help_text=(
+ authenticated = models.BooleanField(default=False, verbose_name=_('Authenticated'), help_text=(
'Flag always active for authenticate users?'))
- languages = models.TextField(blank=True, default='', help_text=(
+ languages = models.TextField(blank=True, default='', verbose_name=_('Languages'), help_text=(
'Activate this flag for users with one of these languages (comma '
'separated list)'))
- groups = models.ManyToManyField(Group, blank=True, help_text=(
+ groups = models.ManyToManyField(Group, blank=True, verbose_name=_('Users'), help_text=(
'Activate this flag for these user groups.'))
- users = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, help_text=(
+ users = models.ManyToManyField(settings.AUTH_USER_MODEL, verbose_name=_('Users'), blank=True, help_text=(
'Activate this flag for these users.'))
- rollout = models.BooleanField(default=False, help_text=(
+ rollout = models.BooleanField(default=False, verbose_name=_('Rollout'), help_text=(
'Activate roll-out mode?'))
- note = models.TextField(blank=True, help_text=(
+ note = models.TextField(blank=True, verbose_name=_('Note'), help_text=(
'Note where this Flag is used.'))
- created = models.DateTimeField(default=timezone.now, db_index=True, help_text=(
+ created = models.DateTimeField(default=timezone.now, verbose_name=_('Created'), db_index=True, help_text=(
'Date when this Flag was created.'))
- modified = models.DateTimeField(default=timezone.now, help_text=(
+ modified = models.DateTimeField(default=timezone.now, verbose_name=_('Modified'), help_text=(
'Date when this Flag was last modified.'))
objects = managers.FlagManager()
@@ -238,17 +240,17 @@ class TenantSwitch(BaseModel):
'countries' is the only field we add. All other fields are copy/pasted from waffle.Switch.
"""
- name = models.CharField(max_length=100, unique=True,
+ name = models.CharField(max_length=100, unique=True, verbose_name=_('Name'),
help_text='The human/computer readable name.')
- active = models.BooleanField(default=False, help_text=(
+ active = models.BooleanField(default=False, verbose_name=_('Active'), help_text=(
'Is this switch active?'))
- countries = models.ManyToManyField(Country, blank=True, help_text=(
+ countries = models.ManyToManyField(Country, blank=True, verbose_name=_('Countries'), help_text=(
'Activate this switch for these countries.'))
- note = models.TextField(blank=True, help_text=(
+ note = models.TextField(blank=True, verbose_name=_('Note'), help_text=(
'Note where this Switch is used.'))
- created = models.DateTimeField(default=timezone.now, db_index=True,
+ created = models.DateTimeField(default=timezone.now, db_index=True, verbose_name=_('Created'),
help_text=('Date when this Switch was created.'))
- modified = models.DateTimeField(default=timezone.now, help_text=(
+ modified = models.DateTimeField(default=timezone.now, verbose_name=_('Modified'), help_text=(
'Date when this Switch was last modified.'))
objects = TenantSwitchManager()
diff --git a/EquiTrack/firms/migrations/0001_initial.py b/EquiTrack/firms/migrations/0001_initial.py
deleted file mode 100644
index 91db22978..000000000
--- a/EquiTrack/firms/migrations/0001_initial.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-05 13:25
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def create_email_template(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
-
- EmailTemplate.objects.get_or_create(name='organisations/staff_member/set_password')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('post_office', '0004_auto_20160607_0901'),
- ]
-
- operations = [
- migrations.RunPython(
- create_email_template,
- migrations.RunPython.noop,
- ),
- ]
diff --git a/EquiTrack/firms/migrations/0002_auto_20180111_1135.py b/EquiTrack/firms/migrations/0002_auto_20180111_1135.py
deleted file mode 100644
index 0e3c0f127..000000000
--- a/EquiTrack/firms/migrations/0002_auto_20180111_1135.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-11 11:35
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def create_email_template(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
-
- EmailTemplate.objects.get_or_create(name='organisations/staff_member/invite')
- EmailTemplate.objects.filter(name='organisations/staff_member/set_password').delete()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('firms', '0001_initial'),
- ('post_office', '0004_auto_20160607_0901'),
- ]
-
- operations = [
- migrations.RunPython(create_email_template, migrations.RunPython.noop)
- ]
diff --git a/EquiTrack/funds/migrations/0001_initial.py b/EquiTrack/funds/migrations/0001_initial.py
index 11ffbbabe..c7121b494 100644
--- a/EquiTrack/funds/migrations/0001_initial.py
+++ b/EquiTrack/funds/migrations/0001_initial.py
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:21
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
+import django.utils.timezone
+import model_utils.fields
class Migration(migrations.Migration):
@@ -18,20 +20,107 @@ class Migration(migrations.Migration):
name='Donor',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=45L, unique=True)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('name', models.CharField(max_length=45, unique=True, verbose_name='Name')),
],
options={
'ordering': ['name'],
},
),
+ migrations.CreateModel(
+ name='FundsCommitmentHeader',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('vendor_code', models.CharField(max_length=20, verbose_name='Vendor Code')),
+ ('fc_number', models.CharField(max_length=20, unique=True, verbose_name='Number')),
+ ('document_date', models.DateField(blank=True, null=True, verbose_name='Document Date')),
+ ('fc_type', models.CharField(blank=True, max_length=50, null=True, verbose_name='Type')),
+ ('currency', models.CharField(blank=True, max_length=50, null=True, verbose_name='Currency')),
+ ('document_text', models.CharField(blank=True, max_length=255, null=True, verbose_name='Document')),
+ ('exchange_rate', models.CharField(blank=True, max_length=20, null=True, verbose_name='Exchange Rate')),
+ ('responsible_person', models.CharField(blank=True, max_length=100, null=True, verbose_name='Responsible')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ migrations.CreateModel(
+ name='FundsCommitmentItem',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('fc_ref_number', models.CharField(blank=True, max_length=30, null=True, verbose_name='Number')),
+ ('line_item', models.CharField(max_length=5, verbose_name='Line Item')),
+ ('wbs', models.CharField(blank=True, max_length=30, null=True, verbose_name='WBS')),
+ ('grant_number', models.CharField(blank=True, max_length=20, null=True, verbose_name='Grant Number')),
+ ('fund', models.CharField(blank=True, max_length=10, null=True, verbose_name='Fund')),
+ ('gl_account', models.CharField(blank=True, max_length=15, null=True, verbose_name='GL Account')),
+ ('due_date', models.DateField(blank=True, null=True, verbose_name='Due Date')),
+ ('fr_number', models.CharField(blank=True, max_length=20, null=True, verbose_name='FR Number')),
+ ('commitment_amount', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Amount')),
+ ('commitment_amount_dc', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Amount DC')),
+ ('amount_changed', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Amount Changed')),
+ ('line_item_text', models.CharField(blank=True, max_length=255, null=True, verbose_name='Description')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='FundsReservationHeader',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('vendor_code', models.CharField(max_length=20, verbose_name='Vendor Code')),
+ ('fr_number', models.CharField(max_length=20, unique=True, verbose_name='FR Number')),
+ ('document_date', models.DateField(blank=True, null=True, verbose_name='Document Date')),
+ ('fr_type', models.CharField(blank=True, max_length=50, null=True, verbose_name='Type')),
+ ('currency', models.CharField(blank=True, max_length=50, null=True, verbose_name='Currency')),
+ ('document_text', models.CharField(blank=True, max_length=255, null=True, verbose_name='Document Text')),
+ ('intervention_amt', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Current FR Amount')),
+ ('total_amt', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='FR Overall Amount')),
+ ('total_amt_local', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='FR Overall Amount DC')),
+ ('actual_amt', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Actual Cash Transfer')),
+ ('actual_amt_local', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Actual Cash Transfer Local')),
+ ('outstanding_amt', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Outstanding DCT')),
+ ('outstanding_amt_local', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Outstanding DCT Local')),
+ ('start_date', models.DateField(blank=True, null=True, verbose_name='Start Date')),
+ ('end_date', models.DateField(blank=True, null=True, verbose_name='End Date')),
+ ],
+ options={
+ 'ordering': ['fr_number'],
+ },
+ ),
+ migrations.CreateModel(
+ name='FundsReservationItem',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('fr_ref_number', models.CharField(blank=True, max_length=30, null=True, verbose_name='Item Number')),
+ ('line_item', models.CharField(max_length=5, verbose_name='Line Item')),
+ ('wbs', models.CharField(blank=True, max_length=30, null=True, verbose_name='WBS')),
+ ('grant_number', models.CharField(blank=True, max_length=20, null=True, verbose_name='Grant Number')),
+ ('fund', models.CharField(blank=True, max_length=10, null=True, verbose_name='Fund')),
+ ('overall_amount', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Overall Amount')),
+ ('overall_amount_dc', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Overall Amount DC')),
+ ('due_date', models.DateField(blank=True, null=True, verbose_name='Due Date')),
+ ('line_item_text', models.CharField(blank=True, max_length=255, null=True, verbose_name='Description')),
+ ('fund_reservation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fr_items', to='funds.FundsReservationHeader', verbose_name='FR Number')),
+ ],
+ ),
migrations.CreateModel(
name='Grant',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=128L, unique=True)),
- ('description', models.CharField(blank=True, max_length=255, null=True)),
- ('expiry', models.DateField(blank=True, null=True)),
- ('donor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.Donor')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('name', models.CharField(max_length=128, unique=True, verbose_name='Name')),
+ ('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='Description')),
+ ('expiry', models.DateField(blank=True, null=True, verbose_name='Expiry')),
+ ('donor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.Donor', verbose_name='Donor')),
],
options={
'ordering': ['donor'],
diff --git a/EquiTrack/funds/migrations/0002_auto_20170227_2305.py b/EquiTrack/funds/migrations/0002_auto_20170227_2305.py
deleted file mode 100644
index 3cd6f6415..000000000
--- a/EquiTrack/funds/migrations/0002_auto_20170227_2305.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-27 21:05
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='FundsCommitmentHeader',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('vendor_code', models.CharField(max_length=20)),
- ('fc_number', models.CharField(max_length=20)),
- ('document_date', models.DateField(blank=True, null=True)),
- ('fc_type', models.CharField(blank=True, max_length=50, null=True)),
- ('currency', models.CharField(blank=True, max_length=50, null=True)),
- ('document_text', models.CharField(blank=True, max_length=255, null=True)),
- ('exchange_rate', models.CharField(blank=True, max_length=20, null=True)),
- ('responsible_person', models.CharField(blank=True, max_length=100, null=True)),
- ],
- ),
- migrations.CreateModel(
- name='FundsCommitmentItem',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('fc_ref_number', models.CharField(blank=True, max_length=30, null=True)),
- ('line_item', models.CharField(max_length=5)),
- ('wbs', models.CharField(blank=True, max_length=30, null=True)),
- ('grant_number', models.CharField(blank=True, max_length=20, null=True)),
- ('fund', models.CharField(blank=True, max_length=10, null=True)),
- ('gl_account', models.CharField(blank=True, max_length=15, null=True)),
- ('due_date', models.DateField(blank=True, null=True)),
- ('fr_number', models.CharField(blank=True, max_length=20, null=True)),
- ('commitment_amount', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
- ('commitment_amount_dc', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
- ('amount_changed', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
- ('line_item_text', models.CharField(blank=True, max_length=255, null=True)),
- ('fund_commitment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fc_items', to='funds.FundsCommitmentHeader')),
- ],
- ),
- migrations.CreateModel(
- name='FundsReservationHeader',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('vendor_code', models.CharField(max_length=20)),
- ('fr_number', models.CharField(max_length=20, unique=True)),
- ('document_date', models.DateField(blank=True, null=True)),
- ('fr_type', models.CharField(blank=True, max_length=50, null=True)),
- ('currency', models.CharField(blank=True, max_length=50, null=True)),
- ('document_text', models.CharField(blank=True, max_length=255, null=True)),
- ('start_date', models.DateField(blank=True, null=True)),
- ('end_date', models.DateField(blank=True, null=True)),
- ],
- options={
- 'ordering': ['fr_number'],
- },
- ),
- migrations.CreateModel(
- name='FundsReservationItem',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('fr_ref_number', models.CharField(blank=True, max_length=30, null=True)),
- ('line_item', models.CharField(max_length=5)),
- ('wbs', models.CharField(blank=True, max_length=30, null=True)),
- ('grant_number', models.CharField(blank=True, max_length=20, null=True)),
- ('fund', models.CharField(blank=True, max_length=10, null=True)),
- ('overall_amount', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
- ('overall_amount_dc', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
- ('due_date', models.DateField(blank=True, null=True)),
- ('line_item_text', models.CharField(blank=True, max_length=255, null=True)),
- ('fund_reservation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fr_items', to='funds.FundsReservationHeader')),
- ],
- ),
- migrations.AlterUniqueTogether(
- name='fundsreservationheader',
- unique_together=set([('vendor_code', 'fr_number')]),
- ),
- migrations.AlterUniqueTogether(
- name='fundsreservationitem',
- unique_together=set([('fund_reservation', 'line_item')]),
- ),
- migrations.AlterUniqueTogether(
- name='fundscommitmentitem',
- unique_together=set([('fund_commitment', 'line_item')]),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0002_auto_20180326_1605.py b/EquiTrack/funds/migrations/0002_auto_20180326_1605.py
new file mode 100644
index 000000000..f8b722b5c
--- /dev/null
+++ b/EquiTrack/funds/migrations/0002_auto_20180326_1605.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2018-03-26 16:05
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('funds', '0001_initial'),
+ ('partners', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='fundsreservationheader',
+ name='intervention',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='frs', to='partners.Intervention', verbose_name='Reference Number'),
+ ),
+ migrations.AddField(
+ model_name='fundscommitmentitem',
+ name='fund_commitment',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fc_items', to='funds.FundsCommitmentHeader', verbose_name='Fund Commitment'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='fundsreservationitem',
+ unique_together=set([('fund_reservation', 'line_item')]),
+ ),
+ migrations.AlterUniqueTogether(
+ name='fundsreservationheader',
+ unique_together=set([('vendor_code', 'fr_number')]),
+ ),
+ migrations.AlterUniqueTogether(
+ name='fundscommitmentitem',
+ unique_together=set([('fund_commitment', 'line_item')]),
+ ),
+ ]
diff --git a/EquiTrack/funds/migrations/0003_auto_20170228_2025.py b/EquiTrack/funds/migrations/0003_auto_20170228_2025.py
deleted file mode 100644
index fd58d3a65..000000000
--- a/EquiTrack/funds/migrations/0003_auto_20170228_2025.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 18:25
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0002_auto_20170227_2305'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='fc_number',
- field=models.CharField(max_length=20, unique=True),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0004_auto_20170620_0133.py b/EquiTrack/funds/migrations/0004_auto_20170620_0133.py
deleted file mode 100644
index ea6a1d7f0..000000000
--- a/EquiTrack/funds/migrations/0004_auto_20170620_0133.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-20 01:33
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0033_auto_20170614_1831'),
- ('funds', '0003_auto_20170228_2025'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='fundsreservationheader',
- name='actual_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='intervention',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='frs', to='partners.Intervention'),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='intervention_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='outstanding_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='total_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0005_auto_20170912_2129.py b/EquiTrack/funds/migrations/0005_auto_20170912_2129.py
deleted file mode 100644
index 443bc8bcd..000000000
--- a/EquiTrack/funds/migrations/0005_auto_20170912_2129.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-12 21:29
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0004_auto_20170620_0133'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='actual_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Actual Cash Transfer'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='intervention_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Current FR Amount'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='outstanding_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Outstanding DCT'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='total_amt',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='FR Overall Amount'),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0006_auto_20171019_1231.py b/EquiTrack/funds/migrations/0006_auto_20171019_1231.py
deleted file mode 100644
index acd2346c4..000000000
--- a/EquiTrack/funds/migrations/0006_auto_20171019_1231.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-19 12:31
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0005_auto_20170912_2129'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='grant',
- options={'ordering': ['donor', 'name', 'description', 'expiry']},
- ),
- migrations.AlterField(
- model_name='grant',
- name='description',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='grant',
- name='donor',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.Donor', verbose_name='Donor'),
- ),
- migrations.AlterField(
- model_name='grant',
- name='expiry',
- field=models.DateField(blank=True, null=True, verbose_name='Expiry'),
- ),
- migrations.AlterField(
- model_name='grant',
- name='name',
- field=models.CharField(max_length=128, unique=True, verbose_name='Name'),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0007_auto_20171019_1332.py b/EquiTrack/funds/migrations/0007_auto_20171019_1332.py
deleted file mode 100644
index 2d963e61c..000000000
--- a/EquiTrack/funds/migrations/0007_auto_20171019_1332.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-19 13:32
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0006_auto_20171019_1231'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='donor',
- name='name',
- field=models.CharField(max_length=45, unique=True, verbose_name='Name'),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0008_auto_20171019_1730.py b/EquiTrack/funds/migrations/0008_auto_20171019_1730.py
deleted file mode 100644
index 6debda4b1..000000000
--- a/EquiTrack/funds/migrations/0008_auto_20171019_1730.py
+++ /dev/null
@@ -1,220 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-19 17:30
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0007_auto_20171019_1332'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='grant',
- options={'ordering': ['donor']},
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='currency',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Currency'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='document_date',
- field=models.DateField(blank=True, null=True, verbose_name='Document Date'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='document_text',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Document'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='exchange_rate',
- field=models.CharField(blank=True, max_length=20, null=True, verbose_name='Exchange Rate'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='fc_number',
- field=models.CharField(max_length=20, unique=True, verbose_name='Number'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='fc_type',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Type'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='responsible_person',
- field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Responsible'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentheader',
- name='vendor_code',
- field=models.CharField(max_length=20, verbose_name='Vendor Code'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='amount_changed',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Amount Changed'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='commitment_amount',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Amount'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='commitment_amount_dc',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Amount DC'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='due_date',
- field=models.DateField(blank=True, null=True, verbose_name='Due Date'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='fc_ref_number',
- field=models.CharField(blank=True, max_length=30, null=True, verbose_name='Number'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='fr_number',
- field=models.CharField(blank=True, max_length=20, null=True, verbose_name='Reservation Number'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='fund',
- field=models.CharField(blank=True, max_length=10, null=True, verbose_name='Fund'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='fund_commitment',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fc_items', to='funds.FundsCommitmentHeader', verbose_name='Fund Commitment'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='gl_account',
- field=models.CharField(blank=True, max_length=15, null=True, verbose_name='Account'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='grant_number',
- field=models.CharField(blank=True, max_length=20, null=True, verbose_name='Grant Number'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='line_item',
- field=models.CharField(max_length=5, verbose_name='Line Item'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='line_item_text',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='wbs',
- field=models.CharField(blank=True, max_length=30, null=True, verbose_name='WBS'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='currency',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Currency'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='document_date',
- field=models.DateField(blank=True, null=True, verbose_name='Document Date'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='document_text',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Document Text'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='end_date',
- field=models.DateField(blank=True, null=True, verbose_name='Start Date'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='fr_number',
- field=models.CharField(max_length=20, unique=True, verbose_name='FR Number'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='fr_type',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Type'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='intervention',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='frs', to='partners.Intervention', verbose_name='Reference Number'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='start_date',
- field=models.DateField(blank=True, null=True, verbose_name='Start Date'),
- ),
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='vendor_code',
- field=models.CharField(max_length=20, verbose_name='Vendor Code'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='due_date',
- field=models.DateField(blank=True, null=True, verbose_name='Due Date'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='fr_ref_number',
- field=models.CharField(blank=True, max_length=30, null=True, verbose_name='Item Number'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='fund',
- field=models.CharField(blank=True, max_length=10, null=True, verbose_name='Fund'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='fund_reservation',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fr_items', to='funds.FundsReservationHeader', verbose_name='Fund Reservation Number'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='grant_number',
- field=models.CharField(blank=True, max_length=20, null=True, verbose_name='Grant Number'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='line_item',
- field=models.CharField(max_length=5, verbose_name='Line Item'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='line_item_text',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='overall_amount',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Overall Amount'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='overall_amount_dc',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Overall Amount DC'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='wbs',
- field=models.CharField(blank=True, max_length=30, null=True, verbose_name='WBS'),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0009_auto_20171026_1046.py b/EquiTrack/funds/migrations/0009_auto_20171026_1046.py
deleted file mode 100644
index 96ac0ce2a..000000000
--- a/EquiTrack/funds/migrations/0009_auto_20171026_1046.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-26 10:46
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0008_auto_20171019_1730'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='fr_number',
- field=models.CharField(blank=True, max_length=20, null=True, verbose_name='FR Number'),
- ),
- migrations.AlterField(
- model_name='fundscommitmentitem',
- name='gl_account',
- field=models.CharField(blank=True, max_length=15, null=True, verbose_name='GL Account'),
- ),
- migrations.AlterField(
- model_name='fundsreservationitem',
- name='fund_reservation',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fr_items', to='funds.FundsReservationHeader', verbose_name='FR Number'),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0010_auto_20171024_1011.py b/EquiTrack/funds/migrations/0010_auto_20171024_1011.py
deleted file mode 100644
index 9b1562d16..000000000
--- a/EquiTrack/funds/migrations/0010_auto_20171024_1011.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-24 10:11
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django.utils.timezone
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0009_auto_20171026_1046'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='donor',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='donor',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='fundscommitmentheader',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='fundscommitmentheader',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='fundscommitmentitem',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='fundscommitmentitem',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='fundsreservationitem',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='fundsreservationitem',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='grant',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='grant',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0011_auto_20180221_1525.py b/EquiTrack/funds/migrations/0011_auto_20180221_1525.py
deleted file mode 100644
index d4e23f427..000000000
--- a/EquiTrack/funds/migrations/0011_auto_20180221_1525.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-02-21 15:25
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0010_auto_20171024_1011'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='fundsreservationheader',
- name='actual_amt_local',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Actual Cash Transfer Local'),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='outstanding_amt_local',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Outstanding DCT Local'),
- ),
- migrations.AddField(
- model_name='fundsreservationheader',
- name='total_amt_local',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='FR Overall Amount DC'),
- ),
- ]
diff --git a/EquiTrack/funds/migrations/0012_auto_20180307_1816.py b/EquiTrack/funds/migrations/0012_auto_20180307_1816.py
deleted file mode 100644
index d9d393d61..000000000
--- a/EquiTrack/funds/migrations/0012_auto_20180307_1816.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-07 18:16
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('funds', '0011_auto_20180221_1525'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='fundsreservationheader',
- name='end_date',
- field=models.DateField(blank=True, null=True, verbose_name='End Date'),
- ),
- ]
diff --git a/EquiTrack/hact/migrations/0001_initial.py b/EquiTrack/hact/migrations/0001_initial.py
index 941c69528..1ac6b79e7 100644
--- a/EquiTrack/hact/migrations/0001_initial.py
+++ b/EquiTrack/hact/migrations/0001_initial.py
@@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-18 18:59
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
-from __future__ import absolute_import
+import EquiTrack.utils
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
-import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
-import EquiTrack.utils
class Migration(migrations.Migration):
@@ -16,23 +14,33 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ('partners', '0054_auto_20171013_2147'),
]
operations = [
migrations.CreateModel(
- name='HactHistory',
+ name='AggregateHact',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('year', models.IntegerField(default=EquiTrack.utils.get_current_year)),
- ('partner_values', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
- ('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_partner', to='partners.PartnerOrganization')),
+ ('year', models.IntegerField(default=EquiTrack.utils.get_current_year, unique=True, verbose_name='Year')),
+ ('partner_values', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True, verbose_name='Partner Values')),
],
+ options={
+ 'abstract': False,
+ },
),
- migrations.AlterUniqueTogether(
- name='hacthistory',
- unique_together=set([('partner', 'year')]),
+ migrations.CreateModel(
+ name='HactHistory',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('year', models.IntegerField(default=EquiTrack.utils.get_current_year, verbose_name='Year')),
+ ('partner_values', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True, verbose_name='Partner Values')),
+ ],
+ options={
+ 'verbose_name_plural': 'Hact Histories',
+ },
),
]
diff --git a/EquiTrack/hact/migrations/0002_aggregatehact.py b/EquiTrack/hact/migrations/0002_aggregatehact.py
deleted file mode 100644
index c0b41972b..000000000
--- a/EquiTrack/hact/migrations/0002_aggregatehact.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-15 15:56
-from __future__ import unicode_literals
-
-from __future__ import absolute_import
-import EquiTrack.utils
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations, models
-import django.utils.timezone
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('hact', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='AggregateHact',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('year', models.IntegerField(default=EquiTrack.utils.get_current_year, unique=True)),
- ('partner_values', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
- ],
- options={
- 'abstract': False,
- },
- ),
- ]
diff --git a/EquiTrack/hact/migrations/0002_auto_20180326_1605.py b/EquiTrack/hact/migrations/0002_auto_20180326_1605.py
new file mode 100644
index 000000000..337259f81
--- /dev/null
+++ b/EquiTrack/hact/migrations/0002_auto_20180326_1605.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2018-03-26 16:05
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('hact', '0001_initial'),
+ ('partners', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='hacthistory',
+ name='partner',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_partner', to='partners.PartnerOrganization', verbose_name='Partner'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='hacthistory',
+ unique_together=set([('partner', 'year')]),
+ ),
+ ]
diff --git a/EquiTrack/hact/migrations/0003_auto_20180309_1210.py b/EquiTrack/hact/migrations/0003_auto_20180309_1210.py
deleted file mode 100644
index df4de3918..000000000
--- a/EquiTrack/hact/migrations/0003_auto_20180309_1210.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-09 12:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('hact', '0002_aggregatehact'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='hacthistory',
- options={'verbose_name_plural': 'Hact Histories'},
- ),
- ]
diff --git a/EquiTrack/hact/models.py b/EquiTrack/hact/models.py
index 7bec7603b..3766ac695 100644
--- a/EquiTrack/hact/models.py
+++ b/EquiTrack/hact/models.py
@@ -29,9 +29,9 @@ def default(self, o):
class HactHistory(TimeStampedModel):
- partner = models.ForeignKey(PartnerOrganization, related_name='related_partner')
- year = models.IntegerField(default=get_current_year)
- partner_values = JSONField(null=True, blank=True)
+ partner = models.ForeignKey(PartnerOrganization, verbose_name=_('Partner'), related_name='related_partner')
+ year = models.IntegerField(default=get_current_year, verbose_name=_('Year'))
+ partner_values = JSONField(null=True, blank=True, verbose_name=_('Partner Values'))
class Meta:
unique_together = ('partner', 'year')
@@ -40,8 +40,8 @@ class Meta:
class AggregateHact(TimeStampedModel):
- year = models.IntegerField(default=get_current_year, unique=True)
- partner_values = JSONField(null=True, blank=True)
+ year = models.IntegerField(default=get_current_year, unique=True, verbose_name=_('Year'))
+ partner_values = JSONField(null=True, blank=True, verbose_name=_('Partner Values'))
def update(self):
self.partner_values = json.dumps({
diff --git a/EquiTrack/locations/migrations/0001_initial.py b/EquiTrack/locations/migrations/0001_initial.py
index 9c348a001..4b63ca755 100644
--- a/EquiTrack/locations/migrations/0001_initial.py
+++ b/EquiTrack/locations/migrations/0001_initial.py
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:21
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
-import django.db.models.manager
+import django.utils.timezone
import locations.models
+import model_utils.fields
import mptt.fields
-import smart_selects.db_fields
class Migration(migrations.Migration):
@@ -16,7 +16,6 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ('contenttypes', '0002_remove_content_type_name'),
]
operations = [
@@ -24,14 +23,14 @@ class Migration(migrations.Migration):
name='CartoDBTable',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('domain', models.CharField(max_length=254)),
- ('api_key', models.CharField(max_length=254)),
- ('table_name', models.CharField(max_length=254)),
- ('display_name', models.CharField(blank=True, max_length=254, null=True)),
- ('name_col', models.CharField(default='name', max_length=254)),
- ('pcode_col', models.CharField(default='pcode', max_length=254)),
- ('parent_code_col', models.CharField(blank=True, max_length=254, null=True)),
- ('color', models.CharField(blank=True, default=locations.models.get_random_color, max_length=7, null=True)),
+ ('domain', models.CharField(max_length=254, verbose_name='Domain')),
+ ('api_key', models.CharField(max_length=254, verbose_name='API Key')),
+ ('table_name', models.CharField(max_length=254, verbose_name='Table Name')),
+ ('display_name', models.CharField(blank=True, max_length=254, null=True, verbose_name='Display Name')),
+ ('name_col', models.CharField(default=b'name', max_length=254, verbose_name='Name Column')),
+ ('pcode_col', models.CharField(default=b'pcode', max_length=254, verbose_name='Pcode Column')),
+ ('parent_code_col', models.CharField(blank=True, max_length=254, null=True, verbose_name='Parent Code Column')),
+ ('color', models.CharField(blank=True, default=locations.models.get_random_color, max_length=7, null=True, verbose_name='Color')),
('lft', models.PositiveIntegerField(db_index=True, editable=False)),
('rght', models.PositiveIntegerField(db_index=True, editable=False)),
('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
@@ -40,130 +39,51 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
- managers=[
- ('objects', django.db.models.manager.Manager()),
- ],
),
migrations.CreateModel(
name='GatewayType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=64L, unique=True)),
+ ('name', models.CharField(max_length=64, unique=True, verbose_name='Name')),
+ ('admin_level', models.PositiveSmallIntegerField(null=True, unique=True, verbose_name='Admin Level')),
],
options={
'ordering': ['name'],
'verbose_name': 'Location Type',
},
),
- migrations.CreateModel(
- name='Governorate',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=45L)),
- ('p_code', models.CharField(blank=True, max_length=32L, null=True)),
- ('color', models.CharField(blank=True, default=locations.models.get_random_color, max_length=7, null=True)),
- ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326)),
- ('gateway', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.GatewayType', verbose_name='Admin type')),
- ],
- options={
- 'ordering': ['name'],
- },
- ),
- migrations.CreateModel(
- name='LinkedLocation',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('object_id', models.PositiveIntegerField()),
- ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
- ('governorate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.Governorate')),
- ],
- ),
- migrations.CreateModel(
- name='Locality',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('cad_code', models.CharField(max_length=11L)),
- ('cas_code', models.CharField(max_length=11L)),
- ('cas_code_un', models.CharField(max_length=11L)),
- ('name', models.CharField(max_length=128L)),
- ('cas_village_name', models.CharField(max_length=128L)),
- ('p_code', models.CharField(blank=True, max_length=32L, null=True)),
- ('color', models.CharField(blank=True, default=locations.models.get_random_color, max_length=7, null=True)),
- ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326)),
- ('gateway', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.GatewayType', verbose_name='Admin type')),
- ],
- options={
- 'ordering': ['name'],
- 'verbose_name': 'Sub-district',
- },
- ),
migrations.CreateModel(
name='Location',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=254L)),
- ('latitude', models.FloatField(blank=True, null=True)),
- ('longitude', models.FloatField(blank=True, null=True)),
- ('p_code', models.CharField(blank=True, max_length=32L, null=True)),
- ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326)),
- ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)),
+ ('name', models.CharField(max_length=254, verbose_name='Name')),
+ ('latitude', models.FloatField(blank=True, null=True, verbose_name='Latitude')),
+ ('longitude', models.FloatField(blank=True, null=True, verbose_name='Longitude')),
+ ('p_code', models.CharField(blank=True, max_length=32, null=True, verbose_name='P Code')),
+ ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326, verbose_name='Geo Point')),
+ ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326, verbose_name='Point')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('lft', models.PositiveIntegerField(db_index=True, editable=False)),
('rght', models.PositiveIntegerField(db_index=True, editable=False)),
('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
('level', models.PositiveIntegerField(db_index=True, editable=False)),
('gateway', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.GatewayType', verbose_name='Location Type')),
- ('locality', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Locality')),
- ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='locations.Location')),
- ],
- options={
- 'ordering': ['name'],
- },
- ),
- migrations.CreateModel(
- name='Region',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=45L)),
- ('p_code', models.CharField(blank=True, max_length=32L, null=True)),
- ('color', models.CharField(blank=True, default=locations.models.get_random_color, max_length=7, null=True)),
- ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326)),
- ('gateway', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.GatewayType', verbose_name='Admin type')),
- ('governorate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.Governorate')),
+ ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='locations.Location', verbose_name='Parent')),
],
options={
'ordering': ['name'],
- 'verbose_name': 'District',
},
),
- migrations.AddField(
- model_name='locality',
- name='region',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.Region'),
- ),
- migrations.AddField(
- model_name='linkedlocation',
- name='locality',
- field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='region', chained_model_field='region', null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Locality'),
- ),
- migrations.AddField(
- model_name='linkedlocation',
- name='location',
- field=smart_selects.db_fields.ChainedForeignKey(blank=True, chained_field='locality', chained_model_field='locality', null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location'),
- ),
- migrations.AddField(
- model_name='linkedlocation',
- name='region',
- field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='governorate', chained_model_field='governorate', on_delete=django.db.models.deletion.CASCADE, to='locations.Region'),
- ),
migrations.AddField(
model_name='cartodbtable',
name='location_type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.GatewayType'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.GatewayType', verbose_name='Location Type'),
),
migrations.AddField(
model_name='cartodbtable',
name='parent',
- field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='locations.CartoDBTable'),
+ field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='locations.CartoDBTable', verbose_name='Parent'),
),
migrations.AlterUniqueTogether(
name='location',
diff --git a/EquiTrack/locations/migrations/0002_auto_20161118_0631.py b/EquiTrack/locations/migrations/0002_auto_20161118_0631.py
deleted file mode 100644
index 22a680639..000000000
--- a/EquiTrack/locations/migrations/0002_auto_20161118_0631.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-18 04:31
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterModelManagers(
- name='cartodbtable',
- managers=[
- ],
- ),
- ]
diff --git a/EquiTrack/locations/migrations/0003_add_trigram_index.py b/EquiTrack/locations/migrations/0003_add_trigram_index.py
deleted file mode 100644
index 62d536017..000000000
--- a/EquiTrack/locations/migrations/0003_add_trigram_index.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0002_auto_20161118_0631'),
- ]
-
- operations = [
- migrations.RunSQL(
- sql="CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA pg_catalog",
- reverse_sql="DROP EXTENSION IF EXISTS pg_trgm CASCADE",
- ),
- migrations.RunSQL(
- sql="CREATE INDEX IF NOT EXISTS index_locations_on_name_trigram on locations_location USING gin (name gin_trgm_ops)",
- reverse_sql="DROP INDEX IF EXISTS index_locations_on_name_trigram"
- ),
- ]
\ No newline at end of file
diff --git a/EquiTrack/locations/migrations/0004_auto_20170112_2051.py b/EquiTrack/locations/migrations/0004_auto_20170112_2051.py
deleted file mode 100644
index 1717fa411..000000000
--- a/EquiTrack/locations/migrations/0004_auto_20170112_2051.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-12 18:51
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('trips', '0003_auto_20170112_2051'),
- ('partners', '0009_auto_20170112_2051'),
- ('locations', '0003_add_trigram_index'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='governorate',
- name='gateway',
- ),
- migrations.RemoveField(
- model_name='linkedlocation',
- name='content_type',
- ),
- migrations.RemoveField(
- model_name='linkedlocation',
- name='governorate',
- ),
- migrations.RemoveField(
- model_name='linkedlocation',
- name='locality',
- ),
- migrations.RemoveField(
- model_name='linkedlocation',
- name='location',
- ),
- migrations.RemoveField(
- model_name='linkedlocation',
- name='region',
- ),
- migrations.RemoveField(
- model_name='locality',
- name='gateway',
- ),
- migrations.RemoveField(
- model_name='locality',
- name='region',
- ),
- migrations.RemoveField(
- model_name='region',
- name='gateway',
- ),
- migrations.RemoveField(
- model_name='region',
- name='governorate',
- ),
- migrations.RemoveField(
- model_name='location',
- name='locality',
- ),
- migrations.DeleteModel(
- name='Governorate',
- ),
- migrations.DeleteModel(
- name='LinkedLocation',
- ),
- migrations.DeleteModel(
- name='Locality',
- ),
- migrations.DeleteModel(
- name='Region',
- ),
- ]
diff --git a/EquiTrack/locations/migrations/0005_auto_20171020_0958.py b/EquiTrack/locations/migrations/0005_auto_20171020_0958.py
deleted file mode 100644
index 948ea9b2d..000000000
--- a/EquiTrack/locations/migrations/0005_auto_20171020_0958.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-20 09:58
-from __future__ import unicode_literals
-
-import django.contrib.gis.db.models.fields
-from django.db import migrations, models
-import django.db.models.deletion
-import mptt.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0005_gatewaytype_admin_level'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='location',
- name='geom',
- field=django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326, verbose_name='Geo Point'),
- ),
- migrations.AlterField(
- model_name='location',
- name='latitude',
- field=models.FloatField(blank=True, null=True, verbose_name='Latitude'),
- ),
- migrations.AlterField(
- model_name='location',
- name='longitude',
- field=models.FloatField(blank=True, null=True, verbose_name='Longitude'),
- ),
- migrations.AlterField(
- model_name='location',
- name='name',
- field=models.CharField(max_length=254, verbose_name='Name'),
- ),
- migrations.AlterField(
- model_name='location',
- name='p_code',
- field=models.CharField(blank=True, max_length=32, null=True, verbose_name='P Code'),
- ),
- migrations.AlterField(
- model_name='location',
- name='parent',
- field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='locations.Location', verbose_name='Parent'),
- ),
- migrations.AlterField(
- model_name='location',
- name='point',
- field=django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326, verbose_name='Point'),
- ),
- ]
diff --git a/EquiTrack/locations/migrations/0005_gatewaytype_admin_level.py b/EquiTrack/locations/migrations/0005_gatewaytype_admin_level.py
deleted file mode 100644
index 55758cfcb..000000000
--- a/EquiTrack/locations/migrations/0005_gatewaytype_admin_level.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-18 16:31
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0004_auto_20170112_2051'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='gatewaytype',
- name='admin_level',
- field=models.PositiveSmallIntegerField(null=True, unique=True),
- ),
- ]
diff --git a/EquiTrack/locations/migrations/0006_auto_20171024_1011.py b/EquiTrack/locations/migrations/0006_auto_20171024_1011.py
deleted file mode 100644
index 870894843..000000000
--- a/EquiTrack/locations/migrations/0006_auto_20171024_1011.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-24 10:11
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django.utils.timezone
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0005_auto_20171020_0958'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='location',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='location',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- ]
diff --git a/EquiTrack/locations/models.py b/EquiTrack/locations/models.py
index 3148b60e3..bfc697166 100644
--- a/EquiTrack/locations/models.py
+++ b/EquiTrack/locations/models.py
@@ -29,8 +29,8 @@ class GatewayType(models.Model):
Represents an Admin Type in location-related models.
"""
- name = models.CharField(max_length=64, unique=True)
- admin_level = models.PositiveSmallIntegerField(null=True, unique=True)
+ name = models.CharField(max_length=64, unique=True, verbose_name=_('Name'))
+ admin_level = models.PositiveSmallIntegerField(null=True, unique=True, verbose_name=_('Admin Level'))
class Meta:
ordering = ['name']
@@ -136,16 +136,17 @@ class CartoDBTable(MPTTModel):
Relates to :model:`locations.GatewayType`
"""
- domain = models.CharField(max_length=254)
- api_key = models.CharField(max_length=254)
- table_name = models.CharField(max_length=254)
- display_name = models.CharField(max_length=254, null=True, blank=True)
- location_type = models.ForeignKey(GatewayType)
- name_col = models.CharField(max_length=254, default='name')
- pcode_col = models.CharField(max_length=254, default='pcode')
- parent_code_col = models.CharField(max_length=254, null=True, blank=True)
- parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True)
- color = models.CharField(null=True, blank=True, default=get_random_color, max_length=7)
+ domain = models.CharField(max_length=254, verbose_name=_('Domain'))
+ api_key = models.CharField(max_length=254, verbose_name=_('API Key'))
+ table_name = models.CharField(max_length=254, verbose_name=_('Table Name'))
+ display_name = models.CharField(max_length=254, null=True, blank=True, verbose_name=_('Display Name'))
+ location_type = models.ForeignKey(GatewayType, verbose_name=_('Location Type'))
+ name_col = models.CharField(max_length=254, default='name', verbose_name=_('Name Column'))
+ pcode_col = models.CharField(max_length=254, default='pcode', verbose_name=_('Pcode Column'))
+ parent_code_col = models.CharField(max_length=254, null=True, blank=True, verbose_name=_('Parent Code Column'))
+ parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True,
+ verbose_name=_('Parent'))
+ color = models.CharField(null=True, blank=True, default=get_random_color, max_length=7, verbose_name=_('Color'))
def __str__(self):
return self.table_name
diff --git a/EquiTrack/management/migrations/0001_initial.py b/EquiTrack/management/migrations/0001_initial.py
index ff317d065..e1d81b48e 100644
--- a/EquiTrack/management/migrations/0001_initial.py
+++ b/EquiTrack/management/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-18 10:01
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.db import migrations, models
@@ -19,13 +19,14 @@ class Migration(migrations.Migration):
name='FlaggedIssue',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('object_id', models.PositiveIntegerField()),
- ('date_created', models.DateTimeField(auto_now_add=True)),
- ('date_updated', models.DateTimeField(auto_now=True)),
- ('issue_category', models.CharField(choices=[('data', 'Data Issue'), ('compliance', 'Compliance Issue')], default='data', max_length=32)),
- ('issue_id', models.CharField(help_text='A readable ID associated with the specific issue, e.g. "pca-no-attachment"', max_length=100)),
- ('message', models.TextField()),
- ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
+ ('object_id', models.PositiveIntegerField(db_index=True, verbose_name='Object ID')),
+ ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
+ ('date_updated', models.DateTimeField(auto_now=True, verbose_name='Updated Date')),
+ ('issue_category', models.CharField(choices=[('data', 'Data Issue'), ('compliance', 'Compliance Issue')], db_index=True, default='data', max_length=32, verbose_name='Issue Category')),
+ ('issue_status', models.CharField(choices=[('new', 'New (untriaged)'), ('pending', 'Pending (triaged, not resolved)'), ('reactivated', 'Reactivated (was resolved but not fixed)'), ('resolved', 'Resolved')], db_index=True, default='new', max_length=32, verbose_name='Issue Status')),
+ ('issue_id', models.CharField(db_index=True, help_text='A readable ID associated with the specific issue, e.g. "pca-no-attachment"', max_length=100, verbose_name='Issue ID')),
+ ('message', models.TextField(verbose_name='Message')),
+ ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Content Type')),
],
),
]
diff --git a/EquiTrack/management/migrations/0002_flaggedissue_issue_status.py b/EquiTrack/management/migrations/0002_flaggedissue_issue_status.py
deleted file mode 100644
index b20abb91c..000000000
--- a/EquiTrack/management/migrations/0002_flaggedissue_issue_status.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-18 10:23
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('management', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='flaggedissue',
- name='issue_status',
- field=models.CharField(choices=[('new', 'New (untriaged)'), ('pending', 'Pending (triaged, not resolved)'), ('resolved', 'Resolved')], default='new', max_length=32),
- ),
- ]
diff --git a/EquiTrack/management/migrations/0003_auto_20170920_1157.py b/EquiTrack/management/migrations/0003_auto_20170920_1157.py
deleted file mode 100644
index 67ea0a387..000000000
--- a/EquiTrack/management/migrations/0003_auto_20170920_1157.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-20 11:57
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('management', '0002_flaggedissue_issue_status'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='flaggedissue',
- name='issue_category',
- field=models.CharField(choices=[('data', 'Data Issue'), ('compliance', 'Compliance Issue')], db_index=True, default='data', max_length=32),
- ),
- migrations.AlterField(
- model_name='flaggedissue',
- name='issue_id',
- field=models.CharField(db_index=True, help_text=b'A readable ID associated with the specific issue, e.g. "pca-no-attachment"', max_length=100),
- ),
- migrations.AlterField(
- model_name='flaggedissue',
- name='issue_status',
- field=models.CharField(choices=[('new', 'New (untriaged)'), ('pending', 'Pending (triaged, not resolved)'), ('reactivated', 'Reactivated (was resolved but not fixed)'), ('resolved', 'Resolved')], db_index=True, default='new', max_length=32),
- ),
- ]
diff --git a/EquiTrack/management/migrations/0004_auto_20170920_1458.py b/EquiTrack/management/migrations/0004_auto_20170920_1458.py
deleted file mode 100644
index 3b9cde481..000000000
--- a/EquiTrack/management/migrations/0004_auto_20170920_1458.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-20 14:58
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('management', '0003_auto_20170920_1157'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='flaggedissue',
- name='object_id',
- field=models.PositiveIntegerField(db_index=True),
- ),
- ]
diff --git a/EquiTrack/management/migrations/0005_issuecheckconfig.py b/EquiTrack/management/migrations/0005_issuecheckconfig.py
deleted file mode 100644
index 36df8912e..000000000
--- a/EquiTrack/management/migrations/0005_issuecheckconfig.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-10 09:55
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('management', '0004_auto_20170920_1458'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='IssueCheckConfig',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('check_id', models.CharField(db_index=True, max_length=100, unique=True)),
- ('is_active', models.BooleanField(default=False)),
- ],
- ),
- ]
diff --git a/EquiTrack/management/migrations/0006_delete_issuecheckconfig.py b/EquiTrack/management/migrations/0006_delete_issuecheckconfig.py
deleted file mode 100644
index 8b435b655..000000000
--- a/EquiTrack/management/migrations/0006_delete_issuecheckconfig.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-10 10:52
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('management', '0005_issuecheckconfig'),
- ]
-
- operations = [
- migrations.DeleteModel(
- name='IssueCheckConfig',
- ),
- ]
diff --git a/EquiTrack/management/models.py b/EquiTrack/management/models.py
index 682eb9b0e..38ffd1964 100644
--- a/EquiTrack/management/models.py
+++ b/EquiTrack/management/models.py
@@ -3,8 +3,9 @@
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
-from django.utils.encoding import python_2_unicode_compatible
from django.utils import six
+from django.utils.encoding import python_2_unicode_compatible
+from django.utils.translation import ugettext as _
from management.issues.exceptions import IssueFoundException
@@ -31,22 +32,23 @@
class FlaggedIssue(models.Model):
# generic foreign key to any object in the DB
# https://docs.djangoproject.com/en/1.11/ref/contrib/contenttypes/#generic-relations
- content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
- object_id = models.PositiveIntegerField(db_index=True)
+ content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, verbose_name=_('Content Type'))
+ object_id = models.PositiveIntegerField(db_index=True, verbose_name=_('Object ID'))
content_object = GenericForeignKey('content_type', 'object_id')
- date_created = models.DateTimeField(auto_now_add=True)
- date_updated = models.DateTimeField(auto_now=True)
+ date_created = models.DateTimeField(auto_now_add=True, verbose_name=_('Creation Date'))
+ date_updated = models.DateTimeField(auto_now=True, verbose_name=_('Updated Date'))
issue_category = models.CharField(max_length=32, choices=ISSUE_CATEGORY_CHOICES, default=ISSUE_CATEGORY_DATA,
- db_index=True)
+ db_index=True, verbose_name=_('Issue Category'))
issue_status = models.CharField(max_length=32, choices=ISSUE_STATUS_CHOICES, default=ISSUE_STATUS_NEW,
- db_index=True)
+ db_index=True, verbose_name=_('Issue Status'))
issue_id = models.CharField(
max_length=100,
help_text='A readable ID associated with the specific issue, e.g. "pca-no-attachment"',
db_index=True,
+ verbose_name=_('Issue ID')
)
- message = models.TextField()
+ message = models.TextField(verbose_name=_('Message'))
def recheck(self):
from management.issues.checks import get_issue_check_by_id # noqa
diff --git a/EquiTrack/supplies/__init__.py b/EquiTrack/notification/management/__init__.py
similarity index 100%
rename from EquiTrack/supplies/__init__.py
rename to EquiTrack/notification/management/__init__.py
diff --git a/EquiTrack/supplies/migrations/__init__.py b/EquiTrack/notification/management/commands/__init__.py
similarity index 100%
rename from EquiTrack/supplies/migrations/__init__.py
rename to EquiTrack/notification/management/commands/__init__.py
diff --git a/EquiTrack/notification/management/commands/update_notifications.py b/EquiTrack/notification/management/commands/update_notifications.py
new file mode 100644
index 000000000..f141ae88b
--- /dev/null
+++ b/EquiTrack/notification/management/commands/update_notifications.py
@@ -0,0 +1,421 @@
+import logging
+
+from django.core.management import BaseCommand
+from django.db import transaction
+from post_office.models import EmailTemplate
+
+logger = logging.getLogger(__name__)
+
+
+class Command(BaseCommand):
+ help = 'Create Notifications command'
+
+ @transaction.atomic
+ def handle(self, *args, **options):
+
+ logger.info(u'Command started')
+
+ # TripCreatedEmail/TripUpdatedEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/created/updated',
+ defaults={
+ 'description': 'The email that is sent to the supervisor, budget owner, traveller for any update',
+ 'subject': 'eTools {{environment}} - Trip {{number}} has been {{state}} for {{owner_name}}',
+ 'content': """
+ Dear Colleague,
+
+ Trip {{number}} has been {{state}} for {{owner_name}} here:
+ {{url}}
+ Purpose of travel: {{ purpose_of_travel }}
+
+ Thank you.
+ """,
+ 'html_content': """
+ Dear Colleague,
+
+ Trip {{number}} has been {{state}} for {{owner_name}} here:
+
+ {{url}}
+
+ Purpose of travel: {{ purpose_of_travel }}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TripApprovedEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/approved',
+ defaults={
+ 'description': 'The email that is sent to the traveller if a trip has been approved',
+ 'subject': 'eTools {{environment}} - Trip Approved: {{trip_reference}}',
+ 'content': """
+ The following trip has been approved: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """,
+ 'html_content': """
+ The following trip has been approved: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TripApprovedEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/approved',
+ defaults={
+ 'description': 'The email that is sent to the traveller if a trip has been approved',
+ 'subject': 'eTools {{environment}} - Trip Approved: {{trip_reference}}',
+ 'content': """
+ The following trip has been approved: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """,
+ 'html_content': """
+ The following trip has been approved: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TripCancelledEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/cancelled',
+ defaults={
+ 'description': 'The email that is sent to everyone if a trip has been cancelled',
+ 'subject': 'eTools {{environment}} - Trip Cancelled: {{trip_reference}}',
+ 'content': """
+ The following trip has been cancelled: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """,
+ 'html_content': """
+ The following trip has been cancelled: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TripCompletedEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/completed',
+ defaults={
+ 'description': 'The email that is sent to travelller and supervisor when a trip has been completed',
+ 'subject': 'eTools {{environment}} - Trip Completed: {{trip_reference}}',
+ 'content': """
+ The following trip has been completed: {{trip_reference}}
+
+ {{url}}
+
+ Action Points:
+
+ {{action_points}}
+
+ Thank you.
+ """,
+ 'html_content': """
+ The following trip has been completed: {{trip_reference}}
+
+ {{url}}
+
+ Action Points:
+
+ {{action_points}}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TripRepresentativeEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/representative',
+ defaults={
+ 'description': 'The email that is sent to the rep to approve a trip',
+ 'subject': 'eTools {{environment}} - Trip Approval Needed: {{trip_reference}}',
+ 'content': """
+ The following trip needs representative approval: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """,
+ 'html_content': """
+ The following trip needs representative approval: {{trip_reference}}
+
+ {{url}}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TripTravelAssistantEmail
+ EmailTemplate.objects.update_or_create(
+ name='travel/trip/travel_or_admin_assistant',
+ defaults={
+ 'description': 'This e-mail will be sent when the trip is approved by the supervisor. It will go to the'
+ 'travel assistant to prompt them to organise the travel (vehicles, flights etc.) and'
+ 'request security clearance.',
+ 'subject': 'eTools {{environment}} - Travel for {{owner_name}}',
+ 'content': """
+ Dear {{travel_assistant}},
+
+ Please organise the travel and security clearance (if needed) for the following trip:
+
+ {{url}}
+
+ Thanks,
+ {{owner_name}}
+ """,
+ 'html_content': """
+ Dear {{travel_assistant}},
+
+ Please organise the travel and security clearance (if needed) for the following trip:
+
+ {{url}}
+
+ Thanks,
+
+ {{owner_name}}
+ """
+ }
+ )
+
+ # TripTAEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/TA_request',
+ defaults={
+ 'description': 'This email is sent to the relevant programme assistant to create the TA for the staff'
+ ' in concern after the approval of the supervisor.',
+ 'subject': 'eTools {{environment}} - Travel Authorization request for {{owner_name}}',
+ 'content': """
+ Dear {{pa_assistant}},
+
+ Kindly draft my Travel Authorization in Vision based on the approved trip:
+
+ {{url}}
+
+ Thanks,
+ {{owner_name}}
+ """,
+ 'html_content': """
+ Dear {{pa_assistant}},
+
+ Kindly draft my Travel Authorization in Vision based on the approved trip:
+
+ {{url}}
+
+ Thanks,
+
+ {{owner_name}}
+ """
+ }
+ )
+
+ # TripTADraftedEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/TA_drafted',
+ defaults={
+ 'description': 'This email is sent to the relevant colleague to approve the TA for the staff in concern'
+ ' after the TA has been drafted in VISION.',
+ 'subject': 'eTools {{environment}} - Travel Authorization drafted for {{owner_name}}',
+ 'content': """
+ Dear {{vision_approver}},"
+
+ Kindly approve my Travel Authorization ({{ta_ref}}) in VISION based on the approved trip:
+
+ {{url}}"
+
+ Thanks,
+ {{owner_name}}
+ """,
+ 'html_content': """
+ Dear {{vision_approver}},"
+
+ Kindly approve my Travel Authorization ({{ta_ref}}) in VISION based on the approved trip:
+
+ {{url}}"
+
+ Thanks,
+
+ {{owner_name}}
+ """
+ }
+ )
+
+ # TripActionPointCreated/TripActionPointUpdated/TTripActionPointClosed
+ EmailTemplate.objects.update_or_create(
+ name='trips/action/created/updated/closed',
+ defaults={
+ 'description': 'Sent when trip action points are created, updated, or closed',
+ 'subject': 'eTools {{environment}} - Trip action point {{state}} for trip: {{trip_reference}}',
+ 'content': """
+ Trip action point by {{owner_name}} for {{responsible}} was {{state}}:"
+ {{url}}
+
+ Thank you.
+ """,
+ 'html_content': """
+ Trip action point by {{owner_name}} for {{responsible}} was {{state}}:"
+
+ {{url}}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TripSummaryEmail
+ EmailTemplate.objects.update_or_create(
+ name='trips/trip/summary',
+ defaults={
+ 'description': 'A summary of trips sent to the owner',
+ 'subject': 'eTools {{environment}} - Trip Summary',
+ 'html_content': """
+ The following is a trip summary for this week:
+
+
+ Trips Coming up:
+
+ {% for key, value in trips_coming_text.items %}
+ - {{key}} - started on {{ value.1 }}
+ {% endfor %}
+
+
+ Overdue Trips:
+
+ {% for key, value in trips_overdue_text.items %}
+ - {{key}} - ended on {{ value.1 }}
+ {% endfor %}
+
+
+
+ Thank you.
+ """
+ }
+ )
+
+ # PartnershipCreatedEmail
+ EmailTemplate.objects.update_or_create(
+ name='partners/partnership/created/updated',
+ defaults={
+ 'description': 'The email that is sent when a PD/SSFA is added or is updated',
+ 'subject': 'PD/SSFA {{number}} has been {{state}}',
+ 'content': """
+ Dear Colleague,
+
+ PD/SSFA {{number}} has been {{state}} here:
+
+ {{url}}
+
+ Thank you.
+ """,
+ 'html_content': """
+ Dear Colleague,
+
+ PD/SSFA {{number}} has been {{state}} here:
+
+ {{url}}
+
+ Thank you.
+ """
+ }
+ )
+
+ # TPM
+ EmailTemplate.objects.update_or_create(
+ name='partners/partnership/signed/frs',
+ defaults={
+ 'description': 'Partnership signed with future start date that has no Fund Reservations',
+ 'subject': 'eTools Intervention {{ number }} does not have any FRs',
+ 'content': """
+ Dear Colleague,
+
+ Please note that the Partnership ref. {{ number }} with {{ partner }} is signed, the start date for the
+ PD/SSFA is {{ start_date }} and there is no FR associated with this partnership in eTools.
+ Please log into eTools and add the FR number to the record, so that the programme document/SSFA status
+ can change to active.
+
+ {{ url }}.
+
+ Please note that this is an automated message and any response to this email cannot be replied to.
+ """
+ }
+ )
+ EmailTemplate.objects.update_or_create(
+ name='partners/partnership/ended/frs/outstanding',
+ defaults={
+ 'description': 'PD Status ended And FR Amount does not equal the Actual Amount.',
+ 'subject': 'eTools Partnership {{ number }} Fund Reservations',
+ 'content': """
+ Dear Colleague,
+
+ Please note that the Partnership ref. {{ number }} with {{ partner }} has ended but the disbursement
+ amount is less than the FR amount.
+ Please follow-up with the IP or adjust your FR.
+
+ {{ url }}.
+
+ Please note that this is an automated message and any response to this email cannot be replied to.
+ """,
+ }
+ )
+
+ EmailTemplate.objects.update_or_create(
+ name='partners/partnership/ending',
+ defaults={
+ 'description': 'PD Ending in 30 or 15 days.',
+ 'subject': 'eTools Partnership {{ number }} is ending in {{ days }} days',
+ 'content': """
+ Dear Colleague,
+
+ Please note that the Partnership ref {{ number }} with {{ partner }} will end in {{ days }} days.
+ Please follow-up with the Implementing Partner on status of implementation, which may require an
+ amendment.
+
+ {{ url }}.
+
+ Please note that this is an automated message and any response to this email cannot be replied to.
+ """
+ }
+ )
+
+ # Auditor Portal
+ EmailTemplate.objects.get_or_create(name='audit/engagement/submit_to_auditor')
+ EmailTemplate.objects.get_or_create(name='audit/engagement/reported_by_auditor')
+ EmailTemplate.objects.get_or_create(name='audit/staff_member/appointed_to_engagement')
+ EmailTemplate.objects.get_or_create(name='audit/engagement/action_point_assigned')
+ EmailTemplate.objects.get_or_create(name='audit/staff_member/invite')
+
+ # TPM Notifications
+ EmailTemplate.objects.get_or_create(name='tpm/visit/assign')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/reject')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/accept')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/generate_report')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/report')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/report_rejected')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/approve_report')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/approve_report_tpm')
+ EmailTemplate.objects.get_or_create(name='tpm/visit/action_point_assigned')
+ EmailTemplate.objects.get_or_create(name='organisations/staff_member/invite')
+ EmailTemplate.objects.get_or_create(name='organisations/staff_member/set_password')
+
+ logger.info(u'Command finished')
diff --git a/EquiTrack/notification/migrations/0001_initial.py b/EquiTrack/notification/migrations/0001_initial.py
index 8441caa10..bca8a8dfe 100644
--- a/EquiTrack/notification/migrations/0001_initial.py
+++ b/EquiTrack/notification/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-24 22:37
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
import django.contrib.postgres.fields
@@ -21,13 +21,13 @@ class Migration(migrations.Migration):
name='Notification',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('type', models.CharField(default='Email', max_length=255)),
- ('object_id', models.PositiveIntegerField(null=True)),
- ('recipients', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), size=None)),
- ('sent_recipients', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), default=list, size=None)),
- ('template_name', models.CharField(max_length=255)),
- ('template_data', django.contrib.postgres.fields.jsonb.JSONField()),
- ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', null=True)),
+ ('type', models.CharField(default='Email', max_length=255, verbose_name='Type')),
+ ('object_id', models.PositiveIntegerField(null=True, verbose_name='Object ID')),
+ ('recipients', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), size=None, verbose_name='Recipients')),
+ ('sent_recipients', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), default=list, size=None, verbose_name='Sent Recipients')),
+ ('template_name', models.CharField(max_length=255, verbose_name='Template Name')),
+ ('template_data', django.contrib.postgres.fields.jsonb.JSONField(verbose_name='Template Data')),
+ ('content_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Content Type')),
],
),
]
diff --git a/EquiTrack/notification/migrations/0002_auto_20170125_0037.py b/EquiTrack/notification/migrations/0002_auto_20170125_0037.py
deleted file mode 100644
index 1687e3d51..000000000
--- a/EquiTrack/notification/migrations/0002_auto_20170125_0037.py
+++ /dev/null
@@ -1,347 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-24 22:37
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def create_email_templates(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
-
- # TripCreatedEmail/TripUpdatedEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/created/updated',
- defaults={
- 'description': 'The email that is sent to the supervisor, budget owner, traveller for any update',
- 'subject': 'eTools {{environment}} - Trip {{number}} has been {{state}} for {{owner_name}}',
- 'content': """
- Dear Colleague,
-
- Trip {{number}} has been {{state}} for {{owner_name}} here:
- {{url}}
- Purpose of travel: {{ purpose_of_travel }}
-
- Thank you.
- """,
- 'html_content': """
- Dear Colleague,
-
- Trip {{number}} has been {{state}} for {{owner_name}} here:
-
- {{url}}
-
- Purpose of travel: {{ purpose_of_travel }}
-
- Thank you.
- """
- }
- )
-
- # TripApprovedEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/approved',
- defaults={
- 'description': 'The email that is sent to the traveller if a trip has been approved',
- 'subject': 'eTools {{environment}} - Trip Approved: {{trip_reference}}',
- 'content': """
- The following trip has been approved: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """,
- 'html_content': """
- The following trip has been approved: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """
- }
- )
-
- # TripApprovedEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/approved',
- defaults={
- 'description': 'The email that is sent to the traveller if a trip has been approved',
- 'subject': 'eTools {{environment}} - Trip Approved: {{trip_reference}}',
- 'content': """
- The following trip has been approved: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """,
- 'html_content': """
- The following trip has been approved: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """
- }
- )
-
- # TripCancelledEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/cancelled',
- defaults={
- 'description': 'The email that is sent to everyone if a trip has been cancelled',
- 'subject': 'eTools {{environment}} - Trip Cancelled: {{trip_reference}}',
- 'content': """
- The following trip has been cancelled: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """,
- 'html_content': """
- The following trip has been cancelled: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """
- }
- )
-
- # TripCompletedEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/completed',
- defaults={
- 'description': 'The email that is sent to travelller and supervisor when a trip has been completed',
- 'subject': 'eTools {{environment}} - Trip Completed: {{trip_reference}}',
- 'content': """
- The following trip has been completed: {{trip_reference}}
-
- {{url}}
-
- Action Points:
-
- {{action_points}}
-
- Thank you.
- """,
- 'html_content': """
- The following trip has been completed: {{trip_reference}}
-
- {{url}}
-
- Action Points:
-
- {{action_points}}
-
- Thank you.
- """
- }
- )
-
- # TripRepresentativeEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/representative',
- defaults={
- 'description': 'The email that is sent to the rep to approve a trip',
- 'subject': 'eTools {{environment}} - Trip Approval Needed: {{trip_reference}}',
- 'content': """
- The following trip needs representative approval: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """,
- 'html_content': """
- The following trip needs representative approval: {{trip_reference}}
-
- {{url}}
-
- Thank you.
- """
- }
- )
-
- # TripTravelAssistantEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'travel/trip/travel_or_admin_assistant',
- defaults={
- 'description': 'This e-mail will be sent when the trip is approved by the supervisor. It will go to the travel assistant to prompt them to organise the travel (vehicles, flights etc.) and request security clearance.',
- 'subject': 'eTools {{environment}} - Travel for {{owner_name}}',
- 'content': """
- Dear {{travel_assistant}},
-
- Please organise the travel and security clearance (if needed) for the following trip:
-
- {{url}}
-
- Thanks,
- {{owner_name}}
- """,
- 'html_content': """
- Dear {{travel_assistant}},
-
- Please organise the travel and security clearance (if needed) for the following trip:
-
- {{url}}
-
- Thanks,
-
- {{owner_name}}
- """
- }
- )
-
- # TripTAEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/TA_request',
- defaults={
- 'description': 'This email is sent to the relevant programme assistant to create the TA for the staff in concern after the approval of the supervisor.',
- 'subject': 'eTools {{environment}} - Travel Authorization request for {{owner_name}}',
- 'content': """
- Dear {{pa_assistant}},
-
- Kindly draft my Travel Authorization in Vision based on the approved trip:
-
- {{url}}
-
- Thanks,
- {{owner_name}}
- """,
- 'html_content': """
- Dear {{pa_assistant}},
-
- Kindly draft my Travel Authorization in Vision based on the approved trip:
-
- {{url}}
-
- Thanks,
-
- {{owner_name}}
- """
- }
- )
-
- # TripTADraftedEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/TA_drafted',
- defaults={
- 'description': 'This email is sent to the relevant colleague to approve the TA for the staff in concern after the TA has been drafted in VISION.',
- 'subject': 'eTools {{environment}} - Travel Authorization drafted for {{owner_name}}',
- 'content': """
- Dear {{vision_approver}},"
-
- Kindly approve my Travel Authorization ({{ta_ref}}) in VISION based on the approved trip:
-
- {{url}}"
-
- Thanks,
- {{owner_name}}
- """,
- 'html_content': """
- Dear {{vision_approver}},"
-
- Kindly approve my Travel Authorization ({{ta_ref}}) in VISION based on the approved trip:
-
- {{url}}"
-
- Thanks,
-
- {{owner_name}}
- """
- }
- )
-
- # TripActionPointCreated/TripActionPointUpdated/TTripActionPointClosed
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/action/created/updated/closed',
- defaults={
- 'description': 'Sent when trip action points are created, updated, or closed',
- 'subject': 'eTools {{environment}} - Trip action point {{state}} for trip: {{trip_reference}}',
- 'content': """
- Trip action point by {{owner_name}} for {{responsible}} was {{state}}:"
-
- {{url}}
-
- Thank you.
- """,
- 'html_content': """
- Trip action point by {{owner_name}} for {{responsible}} was {{state}}:"
-
- {{url}}
-
- Thank you.
- """
- }
- )
-
- # TripSummaryEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'trips/trip/summary',
- defaults={
- 'description': 'A summary of trips sent to the owner',
- 'subject': 'eTools {{environment}} - Trip Summary',
- 'html_content': """
- The following is a trip summary for this week:
-
-
- Trips Coming up:
-
- {% for key, value in trips_coming_text.items %}
- - {{key}} - started on {{ value.1 }}
- {% endfor %}
-
-
- Overdue Trips:
-
- {% for key, value in trips_overdue_text.items %}
- - {{key}} - ended on {{ value.1 }}
- {% endfor %}
-
-
-
- Thank you.
- """
- }
- )
-
- # PartnershipCreatedEmail
- template, created = EmailTemplate.objects.update_or_create(
- name = 'partners/partnership/created/updated',
- defaults={
- 'description': 'The email that is sent when a PD/SSFA is added or is updated',
- 'subject': 'PD/SSFA {{number}} has been {{state}}',
- 'content': """
- Dear Colleague,
-
- PD/SSFA {{number}} has been {{state}} here:
-
- {{url}}
-
- Thank you.
- """,
- 'html_content': """
- Dear Colleague,
-
- PD/SSFA {{number}} has been {{state}} here:
-
- {{url}}
-
- Thank you.
- """
- }
- )
-
-
-def delete_email_templates(apps, schema_editor):
- pass
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('notification', '0001_initial'),
- ('post_office', '0004_auto_20160607_0901'),
- ]
-
- operations = [
- migrations.RunPython(create_email_templates, reverse_code=delete_email_templates)
- ]
diff --git a/EquiTrack/notification/migrations/0003_auto_20170712_1858.py b/EquiTrack/notification/migrations/0003_auto_20170712_1858.py
deleted file mode 100644
index 5865f640e..000000000
--- a/EquiTrack/notification/migrations/0003_auto_20170712_1858.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-12 18:58
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def email_templates(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
-
- template, created = EmailTemplate.objects.update_or_create(
- name='partners/partnership/signed/frs',
- defaults={
- 'description': 'Partnership signed with future start date that has no Fund Reservations',
- 'subject': 'eTools Intervention {{ number }} does not have any FRs',
- 'content': """
- Dear Colleague,
-
- Please note that the Partnership ref. {{ number }} with {{ partner }} is signed, the start date for the PD/SSFA is {{ start_date }} and there is no FR associated with this partnership in eTools.
- Please log into eTools and add the FR number to the record, so that the programme document/SSFA status can change to active.
-
- {{ url }}.
-
- Please note that this is an automated message and any response to this email cannot be replied to.
- """
- }
- )
-
- template, created = EmailTemplate.objects.update_or_create(
- name='partners/partnership/ended/frs/outstanding',
- defaults={
- 'description': 'PD Status “ended” And FR Amount does not equal the Actual Amount.',
- 'subject': 'eTools Partnership {{ number }} Fund Reservations',
- 'content': """
- Dear Colleague,
-
- Please note that the Partnership ref. {{ number }} with {{ partner }} has ended but the disbursement amount is less than the FR amount.
- Please follow-up with the IP or adjust your FR.
-
- {{ url }}.
-
- Please note that this is an automated message and any response to this email cannot be replied to.
- """,
- }
- )
-
- template, created = EmailTemplate.objects.update_or_create(
- name='partners/partnership/ending',
- defaults={
- 'description': 'PD Ending in 30 or 15 days.',
- 'subject': 'eTools Partnership {{ number }} is ending in {{ days }} days',
- 'content': """
- Dear Colleague,
-
- Please note that the Partnership ref {{ number }} with {{ partner }} will end in {{ days }} days.
- Please follow-up with the Implementing Partner on status of implementation, which may require an amendment.
-
- {{ url }}.
-
- Please note that this is an automated message and any response to this email cannot be replied to.
- """
- }
- )
-
-
-def delete_email_templates(apps, schema_editor):
- pass
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('notification', '0002_auto_20170125_0037'),
- ]
-
- operations = [
- migrations.RunPython(email_templates, reverse_code=delete_email_templates)
- ]
diff --git a/EquiTrack/notification/models.py b/EquiTrack/notification/models.py
index 5f1c3dc47..1e70bb2c8 100644
--- a/EquiTrack/notification/models.py
+++ b/EquiTrack/notification/models.py
@@ -12,6 +12,7 @@
from django.template.base import Template, VariableNode
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
+from django.utils.translation import ugettext as _
from model_utils import Choices
from post_office import mail
@@ -58,19 +59,18 @@ class Notification(models.Model):
('tpm/visit/action_point_assigned', 'tpm/visit/action_point_assigned'),
)
- type = models.CharField(max_length=255, default='Email')
- content_type = models.ForeignKey(ContentType, null=True, on_delete=models.CASCADE)
- object_id = models.PositiveIntegerField(null=True)
+ type = models.CharField(max_length=255, default='Email', verbose_name=_('Type'))
+ content_type = models.ForeignKey(ContentType, null=True, on_delete=models.CASCADE, verbose_name=_('Content Type'))
+ object_id = models.PositiveIntegerField(null=True, verbose_name=_('Object ID'))
sender = GenericForeignKey('content_type', 'object_id')
- recipients = ArrayField(
- models.CharField(max_length=255),
- )
+ recipients = ArrayField(models.CharField(max_length=255), verbose_name=_('Recipients'))
sent_recipients = ArrayField(
models.CharField(max_length=255),
- default=list
+ default=list,
+ verbose_name=_('Sent Recipients')
)
- template_name = models.CharField(max_length=255)
- template_data = JSONField()
+ template_name = models.CharField(max_length=255, verbose_name=_('Template Name'))
+ template_data = JSONField(verbose_name=_('Template Data'))
def __str__(self):
return u"{} Notification from {}: {}".format(self.type, self.sender, self.template_data)
diff --git a/EquiTrack/notification/tests/test_email.py b/EquiTrack/notification/tests/test_email.py
index 2d96bf5aa..7471cedf9 100644
--- a/EquiTrack/notification/tests/test_email.py
+++ b/EquiTrack/notification/tests/test_email.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
from django.conf import settings
+from django.core.management import call_command
from django.utils import six
from mock import patch
from post_office.models import Email, EmailTemplate
@@ -17,6 +18,7 @@ def setUpTestData(cls):
cls.tenant.country_short_code = 'LEBA'
cls.tenant.save()
+ call_command('update_notifications')
if EmailTemplate.objects.count() == 0:
cls.fail("No EmailTemplate instances found. Is the migration run?")
diff --git a/EquiTrack/partners/migrations/0001_initial.py b/EquiTrack/partners/migrations/0001_initial.py
index f3f790987..a91956182 100644
--- a/EquiTrack/partners/migrations/0001_initial.py
+++ b/EquiTrack/partners/migrations/0001_initial.py
@@ -1,17 +1,19 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:20
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
+import EquiTrack.fields
import EquiTrack.mixins
-from django.conf import settings
+import EquiTrack.utils
+import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
-from django.contrib.postgres.fields import HStoreField
from django.db import migrations, models
import django.db.models.deletion
+import django.db.models.manager
import django.utils.timezone
+import django_fsm
import model_utils.fields
import partners.models
-import smart_selects.db_fields
class Migration(migrations.Migration):
@@ -19,12 +21,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('users', '__first__'),
- ('reports', '__first__'),
- ('locations', '__first__'),
- ('supplies', '0001_initial'),
- ('funds', '__first__'),
+ ('locations', '0001_initial'),
]
operations = [
@@ -34,123 +31,80 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('agreement_type', models.CharField(choices=[('PCA', 'Programme Cooperation Agreement'), ('SSFA', 'Small Scale Funding Agreement'), ('MOU', 'Memorandum of Understanding'), ('IC', 'Institutional Contract'), ('AWP', 'Work Plan')], max_length=10)),
- ('agreement_number', models.CharField(blank=True, max_length=45L, verbose_name='Reference Number')),
- ('attached_agreement', models.FileField(blank=True, upload_to=partners.models.get_agreement_path)),
- ('start', models.DateField(blank=True, null=True)),
- ('end', models.DateField(blank=True, null=True)),
- ('signed_by_unicef_date', models.DateField(blank=True, null=True)),
- ('signed_by_partner_date', models.DateField(blank=True, null=True)),
- ('bank_name', models.CharField(blank=True, max_length=255, null=True)),
- ('bank_address', models.CharField(blank=True, max_length=256L)),
- ('account_title', models.CharField(blank=True, max_length=255, null=True)),
- ('account_number', models.CharField(blank=True, max_length=50, null=True)),
- ('routing_details', models.CharField(blank=True, help_text='Routing Details, including SWIFT/IBAN (if applicable)', max_length=255, null=True)),
- ('bank_contact_person', models.CharField(blank=True, max_length=255, null=True)),
+ ('agreement_type', models.CharField(choices=[('PCA', 'Programme Cooperation Agreement'), ('SSFA', 'Small Scale Funding Agreement'), ('MOU', 'Memorandum of Understanding')], max_length=10, verbose_name='Agreement Type')),
+ ('agreement_number', models.CharField(blank=True, max_length=45, unique=True, verbose_name='Reference Number')),
+ ('attached_agreement', models.FileField(blank=True, max_length=1024, upload_to=partners.models.get_agreement_path, verbose_name='Attached Agreement')),
+ ('start', models.DateField(blank=True, null=True, verbose_name='Start Date')),
+ ('end', models.DateField(blank=True, null=True, verbose_name='End Date')),
+ ('signed_by_unicef_date', models.DateField(blank=True, null=True, verbose_name='Signed By UNICEF Date')),
+ ('signed_by_partner_date', models.DateField(blank=True, null=True, verbose_name='Signed By Partner Date')),
+ ('status', django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('signed', 'Signed'), ('ended', 'Ended'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32, verbose_name='Status')),
],
options={
- 'abstract': False,
+ 'ordering': ['-created'],
},
- ),
- migrations.CreateModel(
- name='AgreementAmendmentLog',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('type', models.CharField(choices=[('Authorised Officers', 'Authorised Officers'), ('Banking Info', 'Banking Info'), ('Agreement Changes', 'Agreement Changes'), ('Additional Clauses', 'Additional Clauses')], max_length=50)),
- ('amended_at', models.DateField(null=True, verbose_name='Signed At')),
- ('status', models.CharField(blank=True, choices=[('in_process', 'In Process'), ('active', 'Active'), ('implemented', 'Implemented'), ('cancelled', 'Cancelled')], max_length=32L)),
- ('agreement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments_log', to='partners.Agreement')),
+ managers=[
+ ('view_objects', django.db.models.manager.Manager()),
],
- options={
- 'abstract': False,
- },
),
migrations.CreateModel(
- name='AmendmentLog',
+ name='AgreementAmendment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('type', models.CharField(choices=[('No Cost', 'No Cost'), ('Cost', 'Cost'), ('Activity', 'Activity'), ('Other', 'Other')], max_length=50)),
- ('amended_at', models.DateField(null=True, verbose_name='Signed At')),
- ('status', models.CharField(blank=True, choices=[('in_process', 'In Process'), ('active', 'Active'), ('implemented', 'Implemented'), ('cancelled', 'Cancelled')], max_length=32L)),
+ ('number', models.CharField(max_length=5, verbose_name='Number')),
+ ('signed_amendment', models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_agreement_amd_file_path, verbose_name='Signed Amendment')),
+ ('types', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'), ('Change authorized officer', 'Change Authorized Officer(s)'), ('Change banking info', 'Banking Information'), ('Change in clause', 'Change in clause')], max_length=50, verbose_name='Types'), size=None)),
+ ('signed_date', models.DateField(blank=True, null=True, verbose_name='Signed Date')),
],
options={
'abstract': False,
},
+ managers=[
+ ('view_objects', django.db.models.manager.Manager()),
+ ],
),
migrations.CreateModel(
name='Assessment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('type', models.CharField(choices=[('Micro Assessment', 'Micro Assessment'), ('Simplified Checklist', 'Simplified Checklist'), ('Scheduled Audit report', 'Scheduled Audit report'), ('Special Audit report', 'Special Audit report'), ('High Risk Assumed', 'High Risk Assumed'), ('Other', 'Other')], max_length=50)),
- ('names_of_other_agencies', models.CharField(blank=True, help_text='List the names of the other agencies they have worked with', max_length=255, null=True)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('type', models.CharField(choices=[('Micro Assessment', 'Micro Assessment'), ('Simplified Checklist', 'Simplified Checklist'), ('Scheduled Audit report', 'Scheduled Audit report'), ('Special Audit report', 'Special Audit report'), ('Other', 'Other')], max_length=50, verbose_name='Type')),
+ ('names_of_other_agencies', models.CharField(blank=True, help_text='List the names of the other agencies they have worked with', max_length=255, null=True, verbose_name='Other Agencies')),
('expected_budget', models.IntegerField(blank=True, null=True, verbose_name='Planned amount')),
('notes', models.CharField(blank=True, help_text='Note any special requests to be considered during the assessment', max_length=255, null=True, verbose_name='Special requests')),
- ('requested_date', models.DateField(auto_now_add=True)),
- ('planned_date', models.DateField(blank=True, null=True)),
- ('completed_date', models.DateField(blank=True, null=True)),
- ('rating', models.CharField(choices=[('high', 'High'), ('significant', 'Significant'), ('medium', 'Medium'), ('low', 'Low')], default='high', max_length=50)),
- ('report', models.FileField(blank=True, null=True, upload_to='assessments')),
+ ('requested_date', models.DateField(auto_now_add=True, verbose_name='Requested Date')),
+ ('planned_date', models.DateField(blank=True, null=True, verbose_name='Planned Date')),
+ ('completed_date', models.DateField(blank=True, null=True, verbose_name='Completed Date')),
+ ('rating', models.CharField(choices=[('high', 'High'), ('significant', 'Significant'), ('medium', 'Medium'), ('low', 'Low')], default='high', max_length=50, verbose_name='Rating')),
+ ('report', models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_assesment_path, verbose_name='Report')),
('current', models.BooleanField(default=False, verbose_name='Basis for risk rating')),
- ('approving_officer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
- ],
- ),
- migrations.CreateModel(
- name='AuthorizedOfficer',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('agreement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='authorized_officers', to='partners.Agreement')),
- ('amendment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.AgreementAmendmentLog')),
- ],
- ),
- migrations.CreateModel(
- name='BankDetails',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('bank_name', models.CharField(blank=True, max_length=255, null=True)),
- ('bank_address', models.CharField(blank=True, max_length=256L)),
- ('account_title', models.CharField(blank=True, max_length=255, null=True)),
- ('account_number', models.CharField(blank=True, max_length=50, null=True)),
- ('routing_details', models.CharField(blank=True, help_text='Routing Details, including SWIFT/IBAN (if applicable)', max_length=255, null=True)),
- ('bank_contact_person', models.CharField(blank=True, max_length=255, null=True)),
- ('agreement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bank_details', to='partners.Agreement')),
- ('amendment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.AgreementAmendmentLog')),
],
+ options={
+ 'abstract': False,
+ },
),
migrations.CreateModel(
name='DirectCashTransfer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('fc_ref', models.CharField(max_length=50)),
- ('amount_usd', models.DecimalField(decimal_places=2, max_digits=10)),
- ('liquidation_usd', models.DecimalField(decimal_places=2, max_digits=10)),
- ('outstanding_balance_usd', models.DecimalField(decimal_places=2, max_digits=10)),
- ('amount_less_than_3_Months_usd', models.DecimalField(decimal_places=2, max_digits=10)),
- ('amount_3_to_6_months_usd', models.DecimalField(decimal_places=2, max_digits=10)),
- ('amount_6_to_9_months_usd', models.DecimalField(decimal_places=2, max_digits=10)),
- ('amount_more_than_9_Months_usd', models.DecimalField(decimal_places=2, max_digits=10)),
- ],
- ),
- migrations.CreateModel(
- name='DistributionPlan',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('quantity', models.PositiveIntegerField(help_text='Quantity required for this location')),
- ('send', models.BooleanField(default=False, verbose_name='Send to partner?')),
- ('sent', models.BooleanField(default=False)),
- ('document', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
- ('delivered', models.IntegerField(default=0)),
- ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='supplies.SupplyItem')),
+ ('fc_ref', models.CharField(max_length=50, verbose_name='Fund Commitment Reference')),
+ ('amount_usd', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Amount (USD)')),
+ ('liquidation_usd', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Liquidation (USD)')),
+ ('outstanding_balance_usd', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Outstanding Balance (USD)')),
+ ('amount_less_than_3_Months_usd', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Amount mess than 3 months (USD)')),
+ ('amount_3_to_6_months_usd', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Amount between 3 and 6 months (USD)')),
+ ('amount_6_to_9_months_usd', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Amount between 6 and 9 months (USD)')),
+ ('amount_more_than_9_Months_usd', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Amount more than 9 months (USD)')),
],
),
migrations.CreateModel(
name='FileType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=64L, unique=True)),
+ ('name', models.CharField(choices=[('FACE', 'FACE'), ('Progress Report', 'Progress Report'), ('Partnership Review', 'Partnership Review'), ('Final Partnership Review', 'Final Partnership Review'), ('Correspondence', 'Correspondence'), ('Supply/Distribution Plan', 'Supply/Distribution Plan'), ('Other', 'Other')], max_length=64, unique=True, verbose_name='Name')),
],
),
migrations.CreateModel(
@@ -159,366 +113,239 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('start', models.DateTimeField(blank=True, null=True, verbose_name='start')),
('end', models.DateTimeField(blank=True, null=True, verbose_name='end')),
- ('fr_number', models.CharField(max_length=50)),
- ('wbs', models.CharField(max_length=50)),
- ('fc_type', models.CharField(max_length=50)),
- ('fc_ref', models.CharField(blank=True, max_length=50, null=True, unique=True)),
- ('fr_item_amount_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
- ('agreement_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
- ('commitment_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
- ('expenditure_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
- ('grant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='funds.Grant')),
+ ('fr_number', models.CharField(max_length=50, verbose_name='FR Number')),
+ ('wbs', models.CharField(max_length=50, verbose_name='WBS')),
+ ('fc_type', models.CharField(max_length=50, verbose_name='Type')),
+ ('fc_ref', models.CharField(blank=True, max_length=50, null=True, unique=True, verbose_name='Reference')),
+ ('fr_item_amount_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='Item Amount (USD)')),
+ ('agreement_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='Agreement Amount')),
+ ('commitment_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='Commitment Amount')),
+ ('expenditure_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='Expenditure Amount')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
- name='GovernmentIntervention',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('number', models.CharField(blank=True, max_length=45L, verbose_name='Reference Number')),
- ('created_at', models.DateTimeField(auto_now_add=True)),
- ],
- ),
- migrations.CreateModel(
- name='GovernmentInterventionResult',
+ name='Intervention',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('year', models.CharField(max_length=4)),
- ('planned_amount', models.IntegerField(default=0, verbose_name='Planned Cash Transfers')),
- ('activities', HStoreField(blank=True, null=True)),
- ('planned_visits', models.IntegerField(default=0)),
- ('activities_list', models.ManyToManyField(blank=True, related_name='activities_list', to='reports.Result')),
- ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='results', to='partners.GovernmentIntervention')),
- ('result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.Result')),
- ('section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Section')),
- ('sector', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Sector', verbose_name='Programme/Sector')),
- ('unicef_managers', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='Unicef focal points')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('document_type', models.CharField(choices=[('PD', 'Programme Document'), ('SHPD', 'Simplified Humanitarian Programme Document'), ('SSFA', 'SSFA')], max_length=255, verbose_name='Document Type')),
+ ('number', models.CharField(blank=True, max_length=64, null=True, unique=True, verbose_name='Reference Number')),
+ ('title', models.CharField(max_length=256, verbose_name='Document Title')),
+ ('status', django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('signed', 'Signed'), ('active', 'Active'), ('ended', 'Ended'), ('closed', 'Closed'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32, verbose_name='Status')),
+ ('start', models.DateField(blank=True, help_text='The date the Intervention will start', null=True, verbose_name='Start Date')),
+ ('end', models.DateField(blank=True, help_text='The date the Intervention will end', null=True, verbose_name='End Date')),
+ ('submission_date', models.DateField(blank=True, help_text='The date the partner submitted complete PD/SSFA documents to Unicef', null=True, verbose_name='Document Submission Date by CSO')),
+ ('submission_date_prc', models.DateField(blank=True, help_text='The date the documents were submitted to the PRC', null=True, verbose_name='Submission Date to PRC')),
+ ('review_date_prc', models.DateField(blank=True, help_text='The date the PRC reviewed the partnership', null=True, verbose_name='Review Date by PRC')),
+ ('prc_review_document', models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_prc_intervention_file_path, verbose_name='Review Document by PRC')),
+ ('signed_pd_document', models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_prc_intervention_file_path, verbose_name='Signed PD Document')),
+ ('signed_by_unicef_date', models.DateField(blank=True, null=True, verbose_name='Signed by UNICEF Date')),
+ ('signed_by_partner_date', models.DateField(blank=True, null=True, verbose_name='Signed by Partner Date')),
+ ('contingency_pd', models.BooleanField(default=False, verbose_name='Contingency PD')),
+ ('population_focus', models.CharField(blank=True, max_length=130, null=True, verbose_name='Population Focus')),
+ ('in_amendment', models.BooleanField(default=False, verbose_name='Amendment Open')),
+ ('metadata', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='Metadata')),
],
+ options={
+ 'ordering': ['-created'],
+ },
),
migrations.CreateModel(
- name='GwPCALocation',
+ name='InterventionAmendment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('tpm_visit', models.BooleanField(default=False)),
- ('governorate', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Governorate')),
- ('locality', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Locality')),
- ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('types', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('dates', 'Dates'), ('results', 'Results'), ('budget', 'Budget'), ('other', 'Other')], max_length=50, verbose_name='Types'), size=None)),
+ ('other_description', models.CharField(blank=True, max_length=512, null=True, verbose_name='Description')),
+ ('signed_date', models.DateField(null=True, verbose_name='Signed Date')),
+ ('amendment_number', models.IntegerField(default=0, verbose_name='Number')),
+ ('signed_amendment', models.FileField(max_length=1024, upload_to=partners.models.get_intervention_amendment_file_path, verbose_name='Amendment Document')),
],
options={
- 'verbose_name': 'Partnership Location',
+ 'abstract': False,
},
),
migrations.CreateModel(
- name='IndicatorDueDates',
+ name='InterventionAttachment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('due_date', models.DateField(blank=True, null=True)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('attachment', models.FileField(max_length=1024, upload_to=partners.models.get_intervention_attachments_file_path, verbose_name='Attachment')),
],
options={
- 'ordering': ['-due_date'],
- 'verbose_name': 'Report Due Date',
- 'verbose_name_plural': 'Report Due Dates',
+ 'ordering': ['-created'],
},
),
migrations.CreateModel(
- name='IndicatorReport',
+ name='InterventionBudget',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('start', models.DateTimeField(blank=True, null=True, verbose_name='start')),
- ('end', models.DateTimeField(blank=True, null=True, verbose_name='end')),
- ('total', models.PositiveIntegerField()),
- ('disaggregated', models.BooleanField(default=False)),
- ('disaggregation', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
- ('remarks', models.TextField(blank=True, null=True)),
- ('report_status', models.CharField(choices=[('ontrack', 'On Track'), ('constrained', 'Constrained'), ('noprogress', 'No Progress'), ('targetmet', 'Target Met')], default='ontrack', max_length=15)),
- ('indicator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports', to='reports.Indicator')),
- ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')),
+ ('partner_contribution', models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='Partner Contribution')),
+ ('unicef_cash', models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='Unicef Cash')),
+ ('in_kind_amount', models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='UNICEF Supplies')),
+ ('total', models.DecimalField(decimal_places=2, max_digits=20, verbose_name='Total')),
+ ('partner_contribution_local', models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='Partner Contribution Local')),
+ ('unicef_cash_local', models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='Unicef Cash Local')),
+ ('in_kind_amount_local', models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='UNICEF Supplies Local')),
+ ('currency', EquiTrack.fields.CurrencyField(blank=True, choices=[('GIP', 'GIP'), ('KPW', 'KPW'), ('XEU', 'XEU'), ('BHD', 'BHD'), ('BIF', 'BIF'), ('BMD', 'BMD'), ('BSD', 'BSD'), ('YER1', 'YER1'), ('AFN', 'AFN'), ('ALL', 'ALL'), ('AMD', 'AMD'), ('AUD', 'AUD'), ('AZN', 'AZN'), ('BAM', 'BAM'), ('BBD', 'BBD'), ('BDT', 'BDT'), ('BZD', 'BZD'), ('CUP1', 'CUP1'), ('BTN', 'BTN'), ('ZWL', 'ZWL'), ('AWG', 'AWG'), ('CUC', 'CUC'), ('VEF01', 'VEF01'), ('BND', 'BND'), ('BRL', 'BRL'), ('ARS', 'ARS'), ('ETB', 'ETB'), ('EUR', 'EUR'), ('FJD', 'FJD'), ('GBP', 'GBP'), ('GEL', 'GEL'), ('GHS', 'GHS'), ('GNF', 'GNF'), ('GTQ', 'GTQ'), ('GYD', 'GYD'), ('HNL', 'HNL'), ('CAD', 'CAD'), ('CDF', 'CDF'), ('CLP', 'CLP'), ('CNY', 'CNY'), ('COP', 'COP'), ('CRC', 'CRC'), ('CUP', 'CUP'), ('CVE', 'CVE'), ('DJF', 'DJF'), ('DKK', 'DKK'), ('DOP', 'DOP'), ('DZD', 'DZD'), ('EGP', 'EGP'), ('HRK', 'HRK'), ('LVL', 'LVL'), ('LYD', 'LYD'), ('MAD', 'MAD'), ('MGA', 'MGA'), ('MKD', 'MKD'), ('KWD', 'KWD'), ('KYD', 'KYD'), ('LBP', 'LBP'), ('LKR', 'LKR'), ('MDL', 'MDL'), ('KZT', 'KZT'), ('LRD', 'LRD'), ('BOB', 'BOB'), ('HKD', 'HKD'), ('CHF', 'CHF'), ('KES', 'KES'), ('MYR', 'MYR'), ('NGN', 'NGN'), ('KMF', 'KMF'), ('SCR', 'SCR'), ('SEK', 'SEK'), ('TTD', 'TTD'), ('PKR', 'PKR'), ('NIO', 'NIO'), ('RWF', 'RWF'), ('BWP', 'BWP'), ('JMD', 'JMD'), ('TJS', 'TJS'), ('UYU', 'UYU'), ('RON', 'RON'), ('PYG', 'PYG'), ('SYP', 'SYP'), ('LAK', 'LAK'), ('ERN', 'ERN'), ('SLL', 'SLL'), ('PLN', 'PLN'), ('JOD', 'JOD'), ('ILS', 'ILS'), ('AED', 'AED'), ('NPR', 'NPR'), ('NZD', 'NZD'), ('SGD', 'SGD'), ('JPY', 'JPY'), ('PAB', 'PAB'), ('ZMW', 'ZMW'), ('CZK', 'CZK'), ('SOS', 'SOS'), ('LTL', 'LTL'), ('KGS', 'KGS'), ('SHP', 'SHP'), ('BGN', 'BGN'), ('TOP', 'TOP'), ('MVR', 'MVR'), ('VEF02', 'VEF02'), ('TMT', 'TMT'), ('GMD', 'GMD'), ('MZN', 'MZN'), ('RSD', 'RSD'), ('MWK', 'MWK'), ('PGK', 'PGK'), ('MXN', 'MXN'), ('XAF', 'XAF'), ('VND', 'VND'), ('INR', 'INR'), ('NOK', 'NOK'), ('XPF', 'XPF'), ('SSP', 'SSP'), ('IQD', 'IQD'), ('SRD', 'SRD'), ('SAR', 'SAR'), ('XCD', 'XCD'), ('IRR', 'IRR'), ('KPW01', 'KPW01'), ('HTG', 'HTG'), ('IDR', 'IDR'), ('XOF', 'XOF'), ('ISK', 'ISK'), ('ANG', 'ANG'), ('NAD', 'NAD'), ('MMK', 'MMK'), ('STD', 'STD'), ('VUV', 'VUV'), ('LSL', 'LSL'), ('SVC', 'SVC'), ('KHR', 'KHR'), ('SZL', 'SZL'), ('RUB', 'RUB'), ('UAH', 'UAH'), ('UGX', 'UGX'), ('THB', 'THB'), ('AOA', 'AOA'), ('YER', 'YER'), ('USD', 'USD'), ('UZS', 'UZS'), ('OMR', 'OMR'), ('SBD', 'SBD'), ('TZS', 'TZS'), ('SDG', 'SDG'), ('WST', 'WST'), ('QAR', 'QAR'), ('MOP', 'MOP'), ('MRO', 'MRO'), ('VEF', 'VEF'), ('TRY', 'TRY'), ('ZAR', 'ZAR'), ('HUF', 'HUF'), ('MUR', 'MUR'), ('PHP', 'PHP'), ('BYN', 'BYN'), ('KRW', 'KRW'), ('TND', 'TND'), ('MNT', 'MNT'), ('PEN', 'PEN')], max_length=4, null=True, verbose_name='Currency')),
+ ('total_local', models.DecimalField(decimal_places=2, max_digits=20, verbose_name='Total Local')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
- name='PartnerOrganization',
+ name='InterventionPlannedVisits',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('partner_type', models.CharField(choices=[('Bilateral / Multilateral', 'Bilateral / Multilateral'), ('Civil Society Organization', 'Civil Society Organization'), ('Government', 'Government'), ('UN Agency', 'UN Agency')], max_length=50)),
- ('cso_type', models.CharField(blank=True, choices=[('International', 'International'), ('National', 'National'), ('Community Based Organisation', 'Community Based Organisation'), ('Academic Institution', 'Academic Institution')], max_length=50, null=True, verbose_name='CSO Type')),
- ('name', models.CharField(help_text='Please make sure this matches the name you enter in VISION', max_length=255, verbose_name='Full Name')),
- ('short_name', models.CharField(blank=True, max_length=50)),
- ('description', models.CharField(blank=True, max_length=256L)),
- ('shared_partner', models.CharField(choices=[('No', 'No'), ('with UNDP', 'with UNDP'), ('with UNFPA', 'with UNFPA'), ('with UNDP & UNFPA', 'with UNDP & UNFPA')], default='No', help_text='Partner shared with UNDP or UNFPA?', max_length=50)),
- ('address', models.TextField(blank=True, null=True)),
- ('email', models.CharField(blank=True, max_length=255, null=True)),
- ('phone_number', models.CharField(blank=True, max_length=32L, null=True)),
- ('vendor_number', models.CharField(blank=True, max_length=30, null=True, unique=True)),
- ('alternate_id', models.IntegerField(blank=True, null=True)),
- ('alternate_name', models.CharField(blank=True, max_length=255, null=True)),
- ('rating', models.CharField(max_length=50, null=True, verbose_name='Risk Rating')),
- ('type_of_assessment', models.CharField(max_length=50, null=True)),
- ('last_assessment_date', models.DateField(blank=True, null=True)),
- ('core_values_assessment_date', models.DateField(blank=True, null=True, verbose_name='Date positively assessed against core values')),
- ('core_values_assessment', models.FileField(blank=True, help_text='Only required for CSO partners', null=True, upload_to='partners/core_values/')),
- ('vision_synced', models.BooleanField(default=False)),
- ('hidden', models.BooleanField(default=False)),
- ('deleted_flag', models.BooleanField(default=False, verbose_name='Marked for deletion')),
- ('total_ct_cp', models.DecimalField(blank=True, decimal_places=2, help_text='Total Cash Transferred for Country Programme', max_digits=12, null=True)),
- ('total_ct_cy', models.DecimalField(blank=True, decimal_places=2, help_text='Total Cash Transferred per Current Year', max_digits=12, null=True)),
- ('hact_values', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}, null=True)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('year', models.IntegerField(default=EquiTrack.utils.get_current_year, verbose_name='Year')),
+ ('programmatic_q1', models.IntegerField(default=0, verbose_name='Programmatic Q1')),
+ ('programmatic_q2', models.IntegerField(default=0, verbose_name='Programmatic Q2')),
+ ('programmatic_q3', models.IntegerField(default=0, verbose_name='Programmatic Q3')),
+ ('programmatic_q4', models.IntegerField(default=0, verbose_name='Programmatic Q4')),
],
options={
- 'ordering': ['name'],
+ 'verbose_name_plural': 'Intervention Planned Visits',
},
- bases=(EquiTrack.mixins.AdminURLMixin, models.Model),
),
migrations.CreateModel(
- name='PartnershipBudget',
+ name='InterventionReportingPeriod',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('partner_contribution', models.IntegerField(default=0)),
- ('unicef_cash', models.IntegerField(default=0)),
- ('in_kind_amount', models.IntegerField(default=0, verbose_name='UNICEF Supplies')),
- ('year', models.CharField(blank=True, max_length=5, null=True)),
- ('total', models.IntegerField(default=0)),
- ('amendment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='budgets', to='partners.AmendmentLog')),
+ ('start_date', models.DateField(verbose_name='Reporting Period Start Date')),
+ ('end_date', models.DateField(verbose_name='Reporting Period End Date')),
+ ('due_date', models.DateField(verbose_name='Report Due Date')),
],
options={
- 'abstract': False,
+ 'ordering': ['-due_date'],
},
),
migrations.CreateModel(
- name='PartnerStaffMember',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('title', models.CharField(max_length=64L)),
- ('first_name', models.CharField(max_length=64L)),
- ('last_name', models.CharField(max_length=64L)),
- ('email', models.CharField(max_length=128L, unique=True)),
- ('phone', models.CharField(blank=True, max_length=64L)),
- ('active', models.BooleanField(default=True)),
- ('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization')),
- ],
- ),
- migrations.CreateModel(
- name='PCA',
+ name='InterventionResultLink',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('partnership_type', models.CharField(blank=True, choices=[('PD', 'Programme Document'), ('SHPD', 'Simplified Humanitarian Programme Document'), ('AWP', 'Cash Transfers to Government'), ('SSFA', 'SSFA TOR'), ('IC', 'IC TOR')], default='PD', max_length=255, null=True, verbose_name='Document type')),
- ('number', models.CharField(blank=True, max_length=45L, null=True, verbose_name='Reference Number')),
- ('title', models.CharField(max_length=256L)),
- ('project_type', models.CharField(blank=True, choices=[('Bulk Procurement', 'Bulk Procurement'), ('Construction Project', 'Construction Project')], max_length=20, null=True)),
- ('status', models.CharField(blank=True, choices=[('in_process', 'In Process'), ('active', 'Active'), ('implemented', 'Implemented'), ('cancelled', 'Cancelled')], default='in_process', help_text='In Process = In discussion with partner, Active = Currently ongoing, Implemented = completed, Cancelled = cancelled or not approved', max_length=32)),
- ('start_date', models.DateField(blank=True, help_text='The date the Intervention will start', null=True)),
- ('end_date', models.DateField(blank=True, help_text='The date the Intervention will end', null=True)),
- ('initiation_date', models.DateField(help_text='The date the partner submitted complete partnership documents to Unicef', verbose_name='Submission Date')),
- ('submission_date', models.DateField(blank=True, help_text='The date the documents were submitted to the PRC', null=True, verbose_name='Submission Date to PRC')),
- ('review_date', models.DateField(blank=True, help_text='The date the PRC reviewed the partnership', null=True, verbose_name='Review date by PRC')),
- ('signed_by_unicef_date', models.DateField(blank=True, null=True)),
- ('signed_by_partner_date', models.DateField(blank=True, null=True)),
- ('fr_number', models.CharField(blank=True, max_length=50, null=True)),
- ('planned_visits', models.IntegerField(default=0)),
- ('sectors', models.CharField(blank=True, max_length=255, null=True)),
- ('current', models.BooleanField(default=True)),
- ('created_at', models.DateTimeField(auto_now_add=True)),
- ('updated_at', models.DateTimeField(auto_now=True)),
- ('agreement', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='interventions', to='partners.Agreement')),
- ('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='partners.PartnerOrganization')),
- ('partner_focal_point', smart_selects.db_fields.ChainedForeignKey(blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='my_partnerships', to='partners.PartnerStaffMember')),
- ('partner_manager', smart_selects.db_fields.ChainedForeignKey(blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_partnerships', to='partners.PartnerStaffMember', verbose_name='Signed by partner')),
- ('result_structure', models.ForeignKey(blank=True, help_text='Which result structure does this partnership report under?', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='reports.ResultStructure')),
- ('unicef_manager', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='approved_partnerships', to=settings.AUTH_USER_MODEL, verbose_name='Signed by')),
- ('unicef_managers', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='Unicef focal points')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
],
options={
- 'ordering': ['-created_at'],
- 'verbose_name': 'Intervention',
- 'verbose_name_plural': 'Interventions',
+ 'abstract': False,
},
- bases=(EquiTrack.mixins.AdminURLMixin, models.Model),
- ),
- migrations.CreateModel(
- name='PCAFile',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('attachment', models.FileField(max_length=255, upload_to=partners.models.get_file_path)),
- ('pca', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='partners.PCA')),
- ('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.FileType')),
- ],
),
migrations.CreateModel(
- name='PCAGrant',
+ name='InterventionSectorLocationLink',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('funds', models.IntegerField(blank=True, null=True)),
- ('amendment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='grants', to='partners.AmendmentLog')),
- ('grant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.Grant')),
- ('partnership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PCA')),
+ ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sector_locations', to='partners.Intervention', verbose_name='Intervention')),
+ ('locations', models.ManyToManyField(blank=True, related_name='intervention_sector_locations', to='locations.Location', verbose_name='Locations')),
],
options={
- 'ordering': ['-funds'],
+ 'abstract': False,
},
),
migrations.CreateModel(
- name='PCASector',
+ name='PartnerOrganization',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('amendment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sectors', to='partners.AmendmentLog')),
- ('pca', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PCA')),
- ('sector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.Sector')),
+ ('partner_type', models.CharField(choices=[('Bilateral / Multilateral', 'Bilateral / Multilateral'), ('Civil Society Organization', 'Civil Society Organization'), ('Government', 'Government'), ('UN Agency', 'UN Agency')], max_length=50, verbose_name='Partner Type')),
+ ('cso_type', models.CharField(blank=True, choices=[('International', 'International'), ('National', 'National'), ('Community Based Organization', 'Community Based Organization'), ('Academic Institution', 'Academic Institution')], max_length=50, null=True, verbose_name='CSO Type')),
+ ('name', models.CharField(help_text='Please make sure this matches the name you enter in VISION', max_length=255, verbose_name='Name')),
+ ('short_name', models.CharField(blank=True, max_length=50, verbose_name='Short Name')),
+ ('description', models.CharField(blank=True, max_length=256, verbose_name='Description')),
+ ('shared_with', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN', 'UN'), ('UN Women', 'UN Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=20), blank=True, null=True, size=None, verbose_name='Shared Partner')),
+ ('street_address', models.CharField(blank=True, max_length=500, null=True, verbose_name='Street Address')),
+ ('city', models.CharField(blank=True, max_length=64, null=True, verbose_name='City')),
+ ('postal_code', models.CharField(blank=True, max_length=32, null=True, verbose_name='Postal Code')),
+ ('country', models.CharField(blank=True, max_length=64, null=True, verbose_name='Country')),
+ ('address', models.TextField(blank=True, null=True, verbose_name='Address')),
+ ('email', models.CharField(blank=True, max_length=255, null=True, verbose_name='Email Address')),
+ ('phone_number', models.CharField(blank=True, max_length=64, null=True, verbose_name='Phone Number')),
+ ('vendor_number', models.CharField(blank=True, max_length=30, null=True, unique=True, verbose_name='Vendor Number')),
+ ('alternate_id', models.IntegerField(blank=True, null=True, verbose_name='Alternate ID')),
+ ('alternate_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='Alternate Name')),
+ ('rating', models.CharField(blank=True, choices=[('High', 'High'), ('Significant', 'Significant'), ('Moderate', 'Medium'), ('Low', 'Low'), ('Non-Assessed', 'Non Required')], max_length=50, null=True, verbose_name='Risk Rating')),
+ ('type_of_assessment', models.CharField(max_length=50, null=True, verbose_name='Assessment Type')),
+ ('last_assessment_date', models.DateField(blank=True, null=True, verbose_name='Last Assessment Date')),
+ ('core_values_assessment_date', models.DateField(blank=True, null=True, verbose_name='Date positively assessed against core values')),
+ ('core_values_assessment', models.FileField(blank=True, help_text='Only required for CSO partners', max_length=1024, null=True, upload_to='partners/core_values/', verbose_name='Core Values Assessment')),
+ ('vision_synced', models.BooleanField(default=False, verbose_name='VISION Synced')),
+ ('blocked', models.BooleanField(default=False, verbose_name='Blocked')),
+ ('hidden', models.BooleanField(default=False, verbose_name='Hidden')),
+ ('deleted_flag', models.BooleanField(default=False, verbose_name='Marked for deletion')),
+ ('total_ct_cp', models.DecimalField(blank=True, decimal_places=2, help_text='Total Cash Transferred for Country Programme', max_digits=12, null=True, verbose_name='Total Cash Transferred for Country Programme')),
+ ('total_ct_cy', models.DecimalField(blank=True, decimal_places=2, help_text='Total Cash Transferred per Current Year', max_digits=12, null=True, verbose_name='Total Cash Transferred per Current Year')),
+ ('net_ct_cy', models.DecimalField(blank=True, decimal_places=2, help_text='Net Cash Transferred per Current Year', max_digits=12, null=True, verbose_name='Net Cash Transferred')),
+ ('reported_cy', models.DecimalField(blank=True, decimal_places=2, help_text='Liquidations 1 Oct - 30 Sep', max_digits=12, null=True, verbose_name='Liquidation')),
+ ('total_ct_ytd', models.DecimalField(blank=True, decimal_places=2, help_text='Cash Transfers Jan - Dec', max_digits=12, null=True, verbose_name='Cash Transfer Jan - Dec')),
+ ('hact_values', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=partners.models.hact_default, null=True, verbose_name='HACT')),
+ ('basis_for_risk_rating', models.CharField(blank=True, max_length=50, null=True, verbose_name='Basis for Risk Rating')),
],
options={
- 'verbose_name': 'PCA Sector',
+ 'ordering': ['name'],
},
+ bases=(EquiTrack.mixins.AdminURLMixin, models.Model),
),
migrations.CreateModel(
- name='PCASectorGoal',
+ name='PartnerStaffMember',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('goal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.Goal')),
- ('pca_sector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PCASector')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('title', models.CharField(blank=True, max_length=64, null=True, verbose_name='Title')),
+ ('first_name', models.CharField(max_length=64, verbose_name='First Name')),
+ ('last_name', models.CharField(max_length=64, verbose_name='Last Name')),
+ ('email', models.CharField(max_length=128, unique=True, verbose_name='Email Address')),
+ ('phone', models.CharField(blank=True, max_length=64, null=True, verbose_name='Phone Number')),
+ ('active', models.BooleanField(default=True, verbose_name='Active')),
+ ('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='staff_members', to='partners.PartnerOrganization', verbose_name='Partner')),
],
options={
- 'verbose_name': 'CCC',
- 'verbose_name_plural': 'CCCs',
+ 'abstract': False,
},
),
migrations.CreateModel(
- name='RAMIndicator',
+ name='PlannedEngagement',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('indicator', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='result', chained_model_field='result', null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Indicator')),
- ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='indicators', to='partners.PCA')),
- ('result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.Result')),
- ],
- ),
- migrations.CreateModel(
- name='ResultChain',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('code', models.CharField(blank=True, max_length=50, null=True)),
- ('target', models.PositiveIntegerField(blank=True, null=True)),
- ('current_progress', models.PositiveIntegerField(default=0)),
- ('partner_contribution', models.IntegerField(default=0)),
- ('unicef_cash', models.IntegerField(default=0)),
- ('in_kind_amount', models.IntegerField(default=0)),
- ('disaggregation', django.contrib.postgres.fields.jsonb.JSONField(null=True)),
- ('indicator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Indicator')),
- ('partnership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='results', to='partners.PCA')),
- ('result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.Result')),
- ('result_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.ResultType')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('spot_check_mr', EquiTrack.fields.QuarterField(blank=True, choices=[(b'q1', b'Q1'), (b'q2', b'Q2'), (b'q3', b'Q3'), (b'q4', b'Q4')], max_length=2, null=True, verbose_name='Spot Check MR')),
+ ('spot_check_follow_up_q1', models.IntegerField(default=0, verbose_name='Spot Check Q1')),
+ ('spot_check_follow_up_q2', models.IntegerField(default=0, verbose_name='Spot Check Q2')),
+ ('spot_check_follow_up_q3', models.IntegerField(default=0, verbose_name='Spot Check Q3')),
+ ('spot_check_follow_up_q4', models.IntegerField(default=0, verbose_name='Spot Check Q4')),
+ ('scheduled_audit', models.BooleanField(default=False, verbose_name='Scheduled Audit')),
+ ('special_audit', models.BooleanField(default=False, verbose_name='Special Audit')),
+ ('partner', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='planned_engagement', to='partners.PartnerOrganization', verbose_name='Partner')),
],
+ options={
+ 'abstract': False,
+ },
),
migrations.CreateModel(
- name='SupplyPlan',
+ name='WorkspaceFileType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('quantity', models.PositiveIntegerField(help_text='Total quantity needed for this intervention')),
- ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='supplies.SupplyItem')),
- ('partnership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='supply_plans', to='partners.PCA')),
+ ('name', models.CharField(max_length=64, unique=True, verbose_name='Name')),
],
),
- migrations.AddField(
- model_name='partnershipbudget',
- name='partnership',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='budget_log', to='partners.PCA'),
- ),
migrations.AlterUniqueTogether(
name='partnerorganization',
unique_together=set([('name', 'vendor_number')]),
),
- migrations.AddField(
- model_name='indicatorreport',
- name='partner_staff_member',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='indicator_reports', to='partners.PartnerStaffMember'),
- ),
- migrations.AddField(
- model_name='indicatorreport',
- name='result_chain',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='indicator_reports', to='partners.ResultChain'),
- ),
- migrations.AddField(
- model_name='indicatorduedates',
- name='intervention',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='indicator_due_dates', to='partners.PCA'),
- ),
- migrations.AddField(
- model_name='gwpcalocation',
- name='pca',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='locations', to='partners.PCA'),
- ),
- migrations.AddField(
- model_name='gwpcalocation',
- name='region',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Region'),
- ),
- migrations.AddField(
- model_name='gwpcalocation',
- name='sector',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Sector'),
- ),
- migrations.AddField(
- model_name='governmentintervention',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='work_plans', to='partners.PartnerOrganization'),
- ),
- migrations.AddField(
- model_name='governmentintervention',
- name='result_structure',
- field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='reports.ResultStructure'),
- ),
- migrations.AddField(
- model_name='distributionplan',
- name='partnership',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='distribution_plans', to='partners.PCA'),
- ),
- migrations.AddField(
- model_name='distributionplan',
- name='site',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location'),
- ),
- migrations.AddField(
- model_name='authorizedofficer',
- name='officer',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerStaffMember'),
- ),
- migrations.AddField(
- model_name='assessment',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assessments', to='partners.PartnerOrganization'),
- ),
- migrations.AddField(
- model_name='assessment',
- name='requesting_officer',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='requested_assessments', to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='amendmentlog',
- name='partnership',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments_log', to='partners.PCA'),
- ),
- migrations.AddField(
- model_name='agreement',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization'),
- ),
- migrations.AddField(
- model_name='agreement',
- name='partner_manager',
- field=smart_selects.db_fields.ChainedForeignKey(blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerStaffMember', verbose_name='Signed by partner'),
- ),
- migrations.AddField(
- model_name='agreement',
- name='signed_by',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_pcas', to=settings.AUTH_USER_MODEL),
- ),
]
diff --git a/EquiTrack/partners/migrations/0002_auto_20161118_2316.py b/EquiTrack/partners/migrations/0002_auto_20161118_2316.py
deleted file mode 100644
index c69edb5dc..000000000
--- a/EquiTrack/partners/migrations/0002_auto_20161118_2316.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-18 21:16
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='staff_members', to='partners.PartnerOrganization'),
- ),
- migrations.AlterField(
- model_name='pcagrant',
- name='partnership',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='grants', to='partners.PCA'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0002_auto_20180326_1605.py b/EquiTrack/partners/migrations/0002_auto_20180326_1605.py
new file mode 100644
index 000000000..343c75d26
--- /dev/null
+++ b/EquiTrack/partners/migrations/0002_auto_20180326_1605.py
@@ -0,0 +1,174 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2018-03-26 16:05
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+import smart_selects.db_fields
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('reports', '0001_initial'),
+ ('funds', '0002_auto_20180326_1605'),
+ ('users', '0001_initial'),
+ ('locations', '0001_initial'),
+ ('partners', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='interventionsectorlocationlink',
+ name='sector',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='intervention_locations', to='reports.Sector', verbose_name='Sector'),
+ ),
+ migrations.AddField(
+ model_name='interventionresultlink',
+ name='cp_output',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='intervention_links', to='reports.Result', verbose_name='CP Output'),
+ ),
+ migrations.AddField(
+ model_name='interventionresultlink',
+ name='intervention',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='result_links', to='partners.Intervention', verbose_name='Intervention'),
+ ),
+ migrations.AddField(
+ model_name='interventionresultlink',
+ name='ram_indicators',
+ field=models.ManyToManyField(blank=True, to='reports.Indicator', verbose_name='RAM Indicators'),
+ ),
+ migrations.AddField(
+ model_name='interventionreportingperiod',
+ name='intervention',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reporting_periods', to='partners.Intervention', verbose_name='Intervention'),
+ ),
+ migrations.AddField(
+ model_name='interventionplannedvisits',
+ name='intervention',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='planned_visits', to='partners.Intervention', verbose_name='Intervention'),
+ ),
+ migrations.AddField(
+ model_name='interventionbudget',
+ name='intervention',
+ field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='planned_budget', to='partners.Intervention', verbose_name='Intervention'),
+ ),
+ migrations.AddField(
+ model_name='interventionattachment',
+ name='intervention',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='partners.Intervention', verbose_name='Intervention'),
+ ),
+ migrations.AddField(
+ model_name='interventionattachment',
+ name='type',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='partners.FileType', verbose_name='Type'),
+ ),
+ migrations.AddField(
+ model_name='interventionamendment',
+ name='intervention',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments', to='partners.Intervention', verbose_name='Reference Number'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='agreement',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interventions', to='partners.Agreement', verbose_name='Agreement'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='country_programme',
+ field=models.ForeignKey(blank=True, help_text='Which Country Programme does this Intervention belong to?', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='interventions', to='reports.CountryProgramme', verbose_name='Country Programme'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='flat_locations',
+ field=models.ManyToManyField(blank=True, related_name='intervention_flat_locations', to='locations.Location', verbose_name='Locations'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='offices',
+ field=models.ManyToManyField(blank=True, related_name='_intervention_offices_+', to='users.Office', verbose_name='Office'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='partner_authorized_officer_signatory',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_interventions', to='partners.PartnerStaffMember', verbose_name='Signed by Partner'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='partner_focal_points',
+ field=models.ManyToManyField(blank=True, related_name='_intervention_partner_focal_points_+', to='partners.PartnerStaffMember', verbose_name='CSO Authorized Officials'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='sections',
+ field=models.ManyToManyField(blank=True, related_name='interventions', to='reports.Sector', verbose_name='Sections'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='unicef_focal_points',
+ field=models.ManyToManyField(blank=True, related_name='_intervention_unicef_focal_points_+', to=settings.AUTH_USER_MODEL, verbose_name='UNICEF Focal Points'),
+ ),
+ migrations.AddField(
+ model_name='intervention',
+ name='unicef_signatory',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_interventions+', to=settings.AUTH_USER_MODEL, verbose_name='Signed by UNICEF'),
+ ),
+ migrations.AddField(
+ model_name='fundingcommitment',
+ name='grant',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='funds.Grant', verbose_name='Grant'),
+ ),
+ migrations.AddField(
+ model_name='assessment',
+ name='approving_officer',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Approving Officer'),
+ ),
+ migrations.AddField(
+ model_name='assessment',
+ name='partner',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assessments', to='partners.PartnerOrganization', verbose_name='Partner'),
+ ),
+ migrations.AddField(
+ model_name='assessment',
+ name='requesting_officer',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='requested_assessments', to=settings.AUTH_USER_MODEL, verbose_name='Requesting Officer'),
+ ),
+ migrations.AddField(
+ model_name='agreementamendment',
+ name='agreement',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments', to='partners.Agreement', verbose_name='Agreement'),
+ ),
+ migrations.AddField(
+ model_name='agreement',
+ name='authorized_officers',
+ field=models.ManyToManyField(blank=True, related_name='agreement_authorizations', to='partners.PartnerStaffMember', verbose_name='Partner Authorized Officer'),
+ ),
+ migrations.AddField(
+ model_name='agreement',
+ name='country_programme',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements', to='reports.CountryProgramme', verbose_name='Country Programme'),
+ ),
+ migrations.AddField(
+ model_name='agreement',
+ name='partner',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agreements', to='partners.PartnerOrganization', verbose_name='Partner'),
+ ),
+ migrations.AddField(
+ model_name='agreement',
+ name='partner_manager',
+ field=smart_selects.db_fields.ChainedForeignKey(blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements_signed', to='partners.PartnerStaffMember', verbose_name='Signed by partner'),
+ ),
+ migrations.AddField(
+ model_name='agreement',
+ name='signed_by',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements_signed+', to=settings.AUTH_USER_MODEL, verbose_name='Signed By UNICEF'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='interventionplannedvisits',
+ unique_together=set([('intervention', 'year')]),
+ ),
+ ]
diff --git a/EquiTrack/partners/migrations/0003_auto_20161209_2030.py b/EquiTrack/partners/migrations/0003_auto_20161209_2030.py
deleted file mode 100644
index 797d8beac..000000000
--- a/EquiTrack/partners/migrations/0003_auto_20161209_2030.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-09 18:30
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-# def forwards(apps, schema_editor):
-# migrations.RemoveField(
-# model_name='indicatorreport',
-# name='result_chain',
-# ),
-# migrations.AlterField(
-# model_name='indicatorreport',
-# name='indicator',
-# field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports',
-# to='reports.AppliedIndicator'),
-# ),
-#
-# def backwards(apps, schema_editor):
-# migrations.AddField(
-# model_name='indicatorreport',
-# name='result_chain',
-# field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='indicator_reports',
-# to='partners.ResultChain', blank=True, null=True),
-# ),
-# migrations.AlterField(
-# model_name='indicatorreport',
-# name='indicator',
-# field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports',
-# to='reports.Indicator'))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0002_auto_20161118_2316'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='indicatorreport',
- name='result_chain',
- ),
- # Can't yet refer to reports.AppliedIndicator because it's created in reports
- # migration 0003, which depends on this migration. Moved this AlterField
- # to partners migration 0004.
- # migrations.AlterField(
- # model_name='indicatorreport',
- # name='indicator',
- # field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports',
- # to='reports.AppliedIndicator'),
- # ),
- #migrations.RunPython(forwards, reverse_code=backwards),
-
- ]
diff --git a/EquiTrack/partners/migrations/0004_auto_20161227_1916.py b/EquiTrack/partners/migrations/0004_auto_20161227_1916.py
deleted file mode 100644
index e57321530..000000000
--- a/EquiTrack/partners/migrations/0004_auto_20161227_1916.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-27 17:16
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('trips', '0002_remove_linkedpartner_result'),
- ('partners', '0003_auto_20161209_2030'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='indicatorreport',
- name='indicator',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports',
- to='reports.AppliedIndicator'),
- ),
- migrations.RemoveField(
- model_name='resultchain',
- name='indicator',
- ),
- migrations.RemoveField(
- model_name='resultchain',
- name='partnership',
- ),
- migrations.RemoveField(
- model_name='resultchain',
- name='result',
- ),
- migrations.RemoveField(
- model_name='resultchain',
- name='result_type',
- ),
- migrations.DeleteModel(
- name='ResultChain',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0005_auto_20161227_1953.py b/EquiTrack/partners/migrations/0005_auto_20161227_1953.py
deleted file mode 100644
index 9ce3f362f..000000000
--- a/EquiTrack/partners/migrations/0005_auto_20161227_1953.py
+++ /dev/null
@@ -1,391 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-27 17:53
-from __future__ import unicode_literals
-
-from django.conf import settings
-import django.contrib.postgres.fields
-from django.db import migrations, models
-from django.db.models import Count
-import django.db.models.deletion
-import django.db.models.manager
-import django.utils.timezone
-import django_fsm
-import model_utils.fields
-import partners.models
-import smart_selects.db_fields
-import EquiTrack.utils
-
-def reverse(apps, schema_editor):
- pass
-
-def agreement_unique_reference_number(apps, schema_editor):
- Agreement = apps.get_model('partners', 'Agreement')
-
- agreements = Agreement.objects.all()
- for agr in agreements:
- if agr.agreement_number == '':
- print(agr)
- agr.agreement_number = 'TempRef:{}'.format(agr.id)
- agr.save()
- dupes = Agreement.objects.values('agreement_number').annotate(Count('agreement_number')).order_by().filter(agreement_number__count__gt=1).all()
- for dup in dupes:
- cdupes = Agreement.objects.filter(agreement_number=dup['agreement_number'])
- for cdup in cdupes:
- cdup.agreement_number = '{}|{}'.format(cdup.agreement_number, cdup.id)
- print(cdup)
- cdup.save()
-
-def pca_unique_reference_number(apps, schema_editor):
- PCA = apps.get_model('partners', 'PCA')
- pcas = PCA.objects.all()
- for pca in pcas:
- if not pca.number:
- print(pca)
- pca.number = 'blk:{}'.format(pca.id)
- pca.save()
- dupes = PCA.objects.values('number').annotate(
- Count('number')).order_by().filter(number__count__gt=1).all()
- for dup in dupes:
- cdupes = PCA.objects.filter(number=dup['number'])
- for cdup in cdupes:
- if len(cdup.number) > 40:
- cdup.number = cdup.number[len(cdup.number)-40:]
- cdup.number = '{}|{}'.format(cdup.number, cdup.id)
- print(cdup)
- cdup.save()
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0002_auto_20161118_0631'),
- ('users', '0001_initial'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('reports', '0002_auto_20161209_2030'),
- ('partners', '0004_auto_20161227_1916'),
- ]
-
- operations = [
- migrations.RunPython(
- agreement_unique_reference_number, reverse_code=reverse
- ),
- migrations.RunPython(
- pca_unique_reference_number, reverse_code=reverse
- ),
- migrations.CreateModel(
- name='AgreementAmendment',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('number', models.CharField(max_length=5, unique=True)),
- ('type', models.CharField(choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'), ('CP extension', 'Extension of Country Programme Cycle'), ('Change authorized officer', 'Change Authorized Officer'), ('Change banking info', 'Banking Information'), ('Additional clause', 'Additional Clause'), ('Amend existing clause', 'Amend Existing Clause')], max_length=64)),
- ('signed_amendment', models.FileField(blank=True, max_length=255, null=True, upload_to=partners.models.get_agreement_amd_file_path)),
- ('signed_date', models.DateField(blank=True, null=True)),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.CreateModel(
- name='Intervention',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('document_type', models.CharField(choices=[('PD', 'Programme Document'), ('SHPD', 'Simplified Humanitarian Programme Document'), ('SSFA', 'SSFA TOR')], max_length=255, verbose_name='Document type')),
- ('number', models.CharField(max_length=64, verbose_name='Reference Number')),
- ('title', models.CharField(max_length=256)),
- ('status', models.CharField(blank=True, choices=[('draft', 'Draft'), ('active', 'Active'), ('implemented', 'Implemented'), ('suspended', 'Suspended'), ('terminated', 'Terminated'), ('cancelled', 'Cancelled')], default='in_process', help_text='Draft = In discussion with partner, Active = Currently ongoing, Implemented = completed, Terminated = cancelled or not approved', max_length=32)),
- ('start', models.DateField(blank=True, help_text='The date the Intervention will start', null=True)),
- ('end', models.DateField(blank=True, help_text='The date the Intervention will end', null=True)),
- ('submission_date', models.DateField(help_text='The date the partner submitted complete PD/SSFA documents to Unicef')),
- ('submission_date_prc', models.DateField(blank=True, help_text='The date the documents were submitted to the PRC', null=True, verbose_name='Submission Date to PRC')),
- ('review_date_prc', models.DateField(blank=True, help_text='The date the PRC reviewed the partnership', null=True, verbose_name='Review date by PRC')),
- ('prc_review_document', models.FileField(max_length=255, upload_to=partners.models.get_prc_intervention_file_path)),
- ('signed_by_unicef_date', models.DateField(blank=True, null=True)),
- ('signed_by_partner_date', models.DateField(blank=True, null=True)),
- ('fr_numbers', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=50), null=True, size=None)),
- ('population_focus', models.CharField(blank=True, max_length=130, null=True)),
- ],
- options={
- 'ordering': ['-created'],
- },
- ),
- migrations.CreateModel(
- name='InterventionAmendment',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('type', models.CharField(choices=[('Change in Programme Result', 'Change in Programme Result'), ('Change in Population Focus', 'Change in Population Focus'), ('Change in Georgraphical Coverage', 'Change in Georgraphical Coverage'), ('Change in Total Budget >20%', 'Change in Total Budget >20%'), ('Change in Total Budget <=20%', 'Change in Total Budget <=20%'), ('Changes in Activity Budget <=20% - No Change in Total Budget', 'Changes in Activity Budget <=20% - No Change in Total Budget'), ('Changes in Activity Budget >20% - No Change in Total Budget - Prior approval in authorized FACE', 'Changes in Activity Budget >20% - No Change in Total Budget - Prior approval in authorized FACE'), ('Changes in Activity Budget >20% - No Change in Total Budget - Reporting at FACE', 'Changes in Activity Budget >20% - No Change in Total Budget - Reporting at FACE')], max_length=50)),
- ('signed_date', models.DateField(null=True)),
- ('amendment_number', models.IntegerField(default=0)),
- ('signed_amendment', models.FileField(max_length=255, upload_to=partners.models.get_intervention_amendment_file_path)),
- ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments', to='partners.Intervention')),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.CreateModel(
- name='InterventionAttachment',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('attachment', models.FileField(max_length=255, upload_to=partners.models.get_intervention_attachments_file_path)),
- ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='partners.Intervention')),
- ],
- ),
- migrations.CreateModel(
- name='InterventionBudget',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('partner_contribution', models.DecimalField(decimal_places=2, max_digits=20)),
- ('unicef_cash', models.DecimalField(decimal_places=2, max_digits=20)),
- ('in_kind_amount', models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='UNICEF Supplies')),
- ('partner_contribution_local', models.DecimalField(decimal_places=2, max_digits=20)),
- ('unicef_cash_local', models.DecimalField(decimal_places=2, max_digits=20)),
- ('in_kind_amount_local', models.DecimalField(decimal_places=2, max_digits=20, verbose_name='UNICEF Supplies Local')),
- ('year', models.CharField(blank=True, max_length=5, null=True)),
- ('total', models.DecimalField(decimal_places=2, max_digits=20)),
- ('intervention', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='planned_budget', to='partners.Intervention')),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.CreateModel(
- name='InterventionLocationsLink',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ],
- ),
- migrations.CreateModel(
- name='InterventionPlannedVisits',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('year', models.IntegerField(default=EquiTrack.utils.get_current_year)),
- ('programmatic', models.IntegerField(default=0)),
- ('spot_checks', models.IntegerField(default=0)),
- ('audit', models.IntegerField(default=0)),
- ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='planned_visits', to='partners.Intervention')),
- ],
- ),
- migrations.CreateModel(
- name='InterventionResultLink',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('cp_output', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='intervention_links', to='reports.Result')),
- ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='result_links', to='partners.Intervention')),
- ('ram_indicators', models.ManyToManyField(blank=True, to='reports.Indicator')),
- ],
- ),
- migrations.CreateModel(
- name='WorkspaceFileType',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=64L, unique=True)),
- ],
- ),
- migrations.AlterModelManagers(
- name='agreement',
- managers=[
- ('view_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AddField(
- model_name='agreement',
- name='authorized_officers',
- field=models.ManyToManyField(blank=True, related_name='agreement_authorizations', to='partners.PartnerStaffMember'),
- ),
- migrations.AddField(
- model_name='agreement',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('draft', 'Cancelled'), ('active', 'Active'), ('ended', 'Ended'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32),
- ),
- migrations.AddField(
- model_name='agreementamendmentlog',
- name='signed_document',
- field=models.FileField(blank=True, max_length=255, null=True, upload_to=partners.models.get_agreement_amd_file_path),
- ),
- migrations.AddField(
- model_name='bankdetails',
- name='partner_organization',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='bank_details', to='partners.PartnerOrganization'),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='blocked',
- field=models.BooleanField(default=False),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='city',
- field=models.CharField(blank=True, max_length=32L, null=True),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='country',
- field=models.CharField(blank=True, max_length=32L, null=True),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='postal_code',
- field=models.CharField(blank=True, max_length=32L, null=True),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='shared_with',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN', 'UN'), ('Women', 'Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=20), blank=True, null=True, size=None),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='street_address',
- field=models.CharField(blank=True, max_length=500L, null=True),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='agreement_number',
- field=models.CharField(blank=True, max_length=45L, unique=True, verbose_name='Reference Number'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agrements', to='partners.PartnerOrganization'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='partner_manager',
- field=smart_selects.db_fields.ChainedForeignKey(blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements_signed', to='partners.PartnerStaffMember', verbose_name='Signed by partner'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='signed_by',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements_signed+', to=settings.AUTH_USER_MODEL),
- ),
- migrations.AlterField(
- model_name='agreementamendmentlog',
- name='status',
- field=models.CharField(blank=True, choices=[('in_process', 'In Process'), ('active', 'Active'), ('implemented', 'Implemented'), ('cancelled', 'Cancelled'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], max_length=32L),
- ),
- migrations.AlterField(
- model_name='amendmentlog',
- name='status',
- field=models.CharField(blank=True, choices=[('in_process', 'In Process'), ('active', 'Active'), ('implemented', 'Implemented'), ('cancelled', 'Cancelled'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], max_length=32L),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='report',
- field=models.FileField(blank=True, null=True, upload_to=partners.models.get_assesment_path),
- ),
- migrations.AlterField(
- model_name='authorizedofficer',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.Agreement'),
- ),
- migrations.AlterField(
- model_name='distributionplan',
- name='partnership',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='distribution_plans', to='partners.PCA'),
- ),
- migrations.AlterField(
- model_name='partnershipbudget',
- name='partnership',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='budget_log', to='partners.PCA'),
- ),
- migrations.AlterField(
- model_name='pca',
- name='agreement',
- field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pca_interventions', to='partners.Agreement'),
- ),
- migrations.AlterField(
- model_name='pca',
- name='status',
- field=models.CharField(blank=True, choices=[('in_process', 'In Process'), ('active', 'Active'), ('implemented', 'Implemented'), ('cancelled', 'Cancelled'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='in_process', help_text='In Process = In discussion with partner, Active = Currently ongoing, Implemented = completed, Cancelled = cancelled or not approved', max_length=32),
- ),
- migrations.AlterField(
- model_name='supplyplan',
- name='partnership',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='supply_plans', to='partners.PCA'),
- ),
- migrations.AddField(
- model_name='interventionlocationslink',
- name='intervention_result_link',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='location_link', to='partners.InterventionResultLink'),
- ),
- migrations.AddField(
- model_name='interventionlocationslink',
- name='location',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='locations.Location'),
- ),
- migrations.AddField(
- model_name='interventionlocationslink',
- name='sectors',
- field=models.ManyToManyField(blank=True, related_name='intervention_result_locations', to='reports.Sector'),
- ),
- migrations.AddField(
- model_name='interventionattachment',
- name='type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='itervention_attachments+', to='partners.WorkspaceFileType'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interventions', to='partners.Agreement'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='hrp',
- field=models.ForeignKey(blank=True, help_text='Which humanitarian response plan does this PD/SSFA report under?', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='interventions', to='reports.ResultStructure'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='office',
- field=models.ManyToManyField(blank=True, related_name='_intervention_office_+', to='users.Office'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='partner_authorized_officer_signatory',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_interventions', to='partners.PartnerStaffMember'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='partner_focal_points',
- field=models.ManyToManyField(blank=True, related_name='_intervention_partner_focal_points_+', to='partners.PartnerStaffMember'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='sector',
- field=models.ManyToManyField(blank=True, related_name='sector_interventions', to='reports.Sector'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='unicef_focal_points',
- field=models.ManyToManyField(blank=True, related_name='_intervention_unicef_focal_points_+', to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='intervention',
- name='unicef_signatory',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_interventions+', to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='agreementamendment',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments', to='partners.Agreement'),
- ),
- migrations.AddField(
- model_name='distributionplan',
- name='intervention',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='distributions', to='partners.Intervention'),
- ),
- migrations.AddField(
- model_name='supplyplan',
- name='intervention',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='supplies', to='partners.Intervention'),
- ),
- migrations.AlterUniqueTogether(
- name='interventionplannedvisits',
- unique_together=set([('intervention', 'year')]),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0006_auto_20170106_1356.py b/EquiTrack/partners/migrations/0006_auto_20170106_1356.py
deleted file mode 100644
index 9f8e8ea3f..000000000
--- a/EquiTrack/partners/migrations/0006_auto_20170106_1356.py
+++ /dev/null
@@ -1,184 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-06 11:56
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-import django.db.models.deletion
-import django_fsm
-import partners.models
-import EquiTrack.utils
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0002_auto_20161118_0631'),
- ('reports', '0003_auto_20161227_1953'),
- ('users', '0002_userprofile_guid'),
- ('partners', '0005_auto_20161227_1953'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='InterventionSectorLocationLink',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ],
- ),
- migrations.RemoveField(
- model_name='interventionlocationslink',
- name='intervention_result_link',
- ),
- migrations.RemoveField(
- model_name='interventionlocationslink',
- name='location',
- ),
- migrations.RemoveField(
- model_name='interventionlocationslink',
- name='sectors',
- ),
- migrations.RemoveField(
- model_name='agreement',
- name='account_number',
- ),
- migrations.RemoveField(
- model_name='agreement',
- name='account_title',
- ),
- migrations.RemoveField(
- model_name='agreement',
- name='bank_address',
- ),
- migrations.RemoveField(
- model_name='agreement',
- name='bank_contact_person',
- ),
- migrations.RemoveField(
- model_name='agreement',
- name='bank_name',
- ),
- migrations.RemoveField(
- model_name='agreement',
- name='routing_details',
- ),
- migrations.RemoveField(
- model_name='bankdetails',
- name='amendment',
- ),
- migrations.RemoveField(
- model_name='intervention',
- name='office',
- ),
- migrations.RemoveField(
- model_name='intervention',
- name='sector',
- ),
- migrations.AddField(
- model_name='agreement',
- name='country_programme',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements', to='reports.CountryProgramme'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='offices',
- field=models.ManyToManyField(blank=True, related_name='_intervention_offices_+', to='users.Office'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agreements', to='partners.PartnerOrganization'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('cancelled', 'Cancelled'), ('active', 'Active'), ('ended', 'Ended'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32),
- ),
- migrations.AlterField(
- model_name='agreementamendment',
- name='number',
- field=models.CharField(max_length=5),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='fr_numbers',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=50), blank=True, null=True, size=None),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='number',
- field=models.CharField(blank=True, max_length=64, null=True, unique=True, verbose_name='Reference Number'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='prc_review_document',
- field=models.FileField(blank=True, max_length=255, null=True, upload_to=partners.models.get_prc_intervention_file_path),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='submission_date',
- field=models.DateField(blank=True, help_text='The date the partner submitted complete PD/SSFA documents to Unicef', null=True),
- ),
- migrations.AlterField(
- model_name='interventionamendment',
- name='type',
- field=models.CharField(choices=[('CPR', 'Change in Programme Result'), ('CPF', 'Change in Population Focus'), ('CGC', 'Change in Georgraphical Coverage'), ('CTBGT20', 'Change in Total Budget >20%'), ('CTBLT20', 'Change in Total Budget <=20%'), ('CABLT20', 'Changes in Activity Budget <=20% - No Change in Total Budget'), ('CABGT20', 'Changes in Activity Budget >20% - No Change in Total Budget - Prior approval in authorized FACE'), ('CABGT20FACE', 'Changes in Activity Budget >20% - No Change in Total Budget - Reporting at FACE')], max_length=50),
- ),
- migrations.AlterField(
- model_name='interventionattachment',
- name='type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='partners.FileType'),
- ),
- migrations.AlterField(
- model_name='interventionbudget',
- name='in_kind_amount_local',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=20, verbose_name='UNICEF Supplies Local'),
- ),
- migrations.AlterField(
- model_name='interventionbudget',
- name='partner_contribution',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=20),
- ),
- migrations.AlterField(
- model_name='interventionbudget',
- name='partner_contribution_local',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=20),
- ),
- migrations.AlterField(
- model_name='interventionbudget',
- name='unicef_cash',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=20),
- ),
- migrations.AlterField(
- model_name='interventionbudget',
- name='unicef_cash_local',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=20),
- ),
- migrations.AlterField(
- model_name='interventionplannedvisits',
- name='year',
- field=models.IntegerField(default=EquiTrack.utils.get_current_year),
- ),
- migrations.AlterUniqueTogether(
- name='interventionbudget',
- unique_together=set([('year', 'intervention')]),
- ),
- migrations.DeleteModel(
- name='InterventionLocationsLink',
- ),
- migrations.AddField(
- model_name='interventionsectorlocationlink',
- name='intervention',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sector_locations', to='partners.Intervention'),
- ),
- migrations.AddField(
- model_name='interventionsectorlocationlink',
- name='locations',
- field=models.ManyToManyField(blank=True, related_name='intervention_sector_locations', to='locations.Location'),
- ),
- migrations.AddField(
- model_name='interventionsectorlocationlink',
- name='sector',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='intervention_locations', to='reports.Sector'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0007_auto_20170109_1840.py b/EquiTrack/partners/migrations/0007_auto_20170109_1840.py
deleted file mode 100644
index cf5086ca7..000000000
--- a/EquiTrack/partners/migrations/0007_auto_20170109_1840.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-09 16:40
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-def reverse(apps, schema_editor):
- pass
-
-def gov_int_copy_rs_to_cp(apps, schema_editor):
- pass
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0003_auto_20161227_1953'),
- ('partners', '0006_auto_20170106_1356'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='governmentintervention',
- name='country_programme',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_query_name='government_interventions', to='reports.CountryProgramme'),
- ),
- migrations.AlterField(
- model_name='governmentintervention',
- name='result_structure',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='reports.ResultStructure'),
- ),
- migrations.RunPython(
- gov_int_copy_rs_to_cp, reverse_code=reverse
- )
- ]
diff --git a/EquiTrack/partners/migrations/0008_auto_20170110_2245.py b/EquiTrack/partners/migrations/0008_auto_20170110_2245.py
deleted file mode 100644
index dc6d13bf5..000000000
--- a/EquiTrack/partners/migrations/0008_auto_20170110_2245.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-10 20:45
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-def reverse(apps, schema_editor):
- pass
-
-
-def gov_int_copy_section_sectors(apps, schema_editor):
- pass
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0002_userprofile_guid'),
- ('reports', '0003_auto_20161227_1953'),
- ('partners', '0007_auto_20170109_1840'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='governmentinterventionresult',
- name='sections',
- field=models.ManyToManyField(blank=True, related_name='_governmentinterventionresult_sections_+', to='users.Section'),
- ),
- migrations.AddField(
- model_name='governmentinterventionresult',
- name='sectors',
- field=models.ManyToManyField(blank=True, related_name='_governmentinterventionresult_sectors_+', to='reports.Sector', verbose_name='Programme/Sector'),
- ),
- migrations.RunPython(
- gov_int_copy_section_sectors, reverse_code=reverse
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='section',
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='sector',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0009_auto_20170112_2051.py b/EquiTrack/partners/migrations/0009_auto_20170112_2051.py
deleted file mode 100644
index 410b361d4..000000000
--- a/EquiTrack/partners/migrations/0009_auto_20170112_2051.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-12 18:51
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0008_auto_20170110_2245'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='gwpcalocation',
- name='governorate',
- ),
- migrations.RemoveField(
- model_name='gwpcalocation',
- name='locality',
- ),
- migrations.RemoveField(
- model_name='gwpcalocation',
- name='region',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0010_auto_20170125_1303.py b/EquiTrack/partners/migrations/0010_auto_20170125_1303.py
deleted file mode 100644
index 26204b295..000000000
--- a/EquiTrack/partners/migrations/0010_auto_20170125_1303.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-25 11:03
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django_fsm
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0009_auto_20170112_2051'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='intervention',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('active', 'Active'), ('implemented', 'Implemented'), ('suspended', 'Suspended'), ('terminated', 'Terminated'), ('cancelled', 'Cancelled')], default='draft', help_text='Draft = In discussion with partner, Active = Currently ongoing, Implemented = completed, Terminated = cancelled or not approved', max_length=32),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0011_remove_partnerorganization_hact_values.py b/EquiTrack/partners/migrations/0011_remove_partnerorganization_hact_values.py
deleted file mode 100644
index 0c14f3960..000000000
--- a/EquiTrack/partners/migrations/0011_remove_partnerorganization_hact_values.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-26 21:36
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0010_auto_20170125_1303'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='partnerorganization',
- name='hact_values',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0012_partnerorganization_hact_values.py b/EquiTrack/partners/migrations/0012_partnerorganization_hact_values.py
deleted file mode 100644
index ae81d418d..000000000
--- a/EquiTrack/partners/migrations/0012_partnerorganization_hact_values.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-26 21:48
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations
-import partners.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0011_remove_partnerorganization_hact_values'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='partnerorganization',
- name='hact_values',
- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=partners.models.hact_default, null=True),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0013_auto_20170127_0106.py b/EquiTrack/partners/migrations/0013_auto_20170127_0106.py
deleted file mode 100644
index afaf22f46..000000000
--- a/EquiTrack/partners/migrations/0013_auto_20170127_0106.py
+++ /dev/null
@@ -1,245 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-26 23:06
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-def reverse(apps, schema_editor):
- pass
-
-def log_to_file(file_name='fail_logs.txt', *args):
- print([arg for arg in args])
- f = open(file_name, 'a')
- f.close()
-
-def helper_amendment_number(obj, AgreementAmendmentLog):
- """
- Increment amendment number automatically
- """
- objects = list(AgreementAmendmentLog.objects.filter(
- agreement=obj.agreement
- ).order_by('created').values_list('id', flat=True))
-
- return objects.index(obj.id) + 1 if obj.id in objects else len(objects) + 1
-
-def after_partner_migrations(apps, schema_editor):
- AgreementAmendment = apps.get_model('partners', 'AgreementAmendment')
- AgreementAmendmentLog = apps.get_model('partners', 'AgreementAmendmentLog')
- PCA = apps.get_model('partners', 'PCA')
- Intervention = apps.get_model('partners', 'Intervention')
- Result = apps.get_model('reports', 'Result')
- InterventionResultLink = apps.get_model('partners', 'InterventionResultLink')
- PCAFile = apps.get_model('partners', 'PCAFile')
- InterventionAttachment = apps.get_model('partners', 'InterventionAttachment')
- InterventionBudget = apps.get_model('partners', 'InterventionBudget')
- Sector = apps.get_model('reports', 'Sector')
- InterventionSectorLocationLink = apps.get_model('partners', 'InterventionSectorLocationLink')
- SupplyPlan = apps.get_model('partners', 'SupplyPlan')
- DistributionPlan = apps.get_model('partners', 'DistributionPlan')
-
- def copy_pca_fields_to_intervention():
- MAPPING = {
- 'created_at': 'created',
- 'updated_at': 'modified',
- 'partnership_type': 'document_type',
- 'number': 'number',
- 'title': 'title',
- 'status': 'status',
- 'start_date': 'start',
- 'end_date': 'end',
- 'initiation_date': 'submission_date',
- 'submission_date': 'submission_date_prc',
- 'review_date': 'review_date_prc',
- 'signed_by_unicef_date': 'signed_by_unicef_date',
- 'signed_by_partner_date': 'signed_by_partner_date',
- 'agreement': 'agreement',
- 'result_structure': 'hrp',
- 'partner_manager': 'partner_authorized_officer_signatory',
- 'unicef_manager': 'unicef_signatory',
- }
- status_map = {
- 'in_proccess': 'Draft'
- }
- pca_attrs = ['created_at', 'updated_at', 'partnership_type', 'number', 'title', 'status', 'start_date',
- 'end_date',
- 'initiation_date', 'submission_date', 'review_date', 'signed_by_unicef_date',
- 'signed_by_partner_date',
- 'agreement', 'result_structure', 'partner_manager', 'unicef_manager']
- pcas = PCA.objects.all()
- interventions_to_save = []
- for pca in pcas:
- if pca.number == '-':
- print('-')
- if pca.partnership_type in ['AWP', 'IC']:
- continue
- intervention = Intervention()
- for attr in pca_attrs:
- if attr == 'status' and pca.status == u'in_process':
- setattr(intervention, 'status', u'draft')
- elif attr == 'agreement' and not getattr(pca, attr):
- break
- else:
- setattr(intervention, MAPPING[attr], getattr(pca, attr))
- if not intervention.document_type:
- continue
- try:
- if intervention.status in \
- ['active', 'suspended', 'terminated', 'implemented'] and \
- not intervention.signed_by_unicef_date:
- if intervention.start:
- intervention.signed_by_unicef_date = intervention.start
- elif intervention.signed_by_partner_date:
- intervention.signed_by_unicef_date = intervention.signed_by_partner_date
- else:
- intervention.signed_by_unicef_date = intervention.created
- print('before', intervention, intervention.status, intervention.document_type)
- if not intervention.agreement:
- continue
- interventions_to_save.append(intervention)
- except Exception as e:
- print(pca.number)
- print(intervention.number)
- raise e
- print('after', intervention, intervention.status, intervention.document_type)
- Intervention.objects.bulk_create(interventions_to_save)
-
- def agreement_amd_copy():
- agr_amds = AgreementAmendmentLog.objects.all()
- amd_type = ''
- for amd in agr_amds:
- if amd.type == 'Authorised Officers':
- amd_type = 'Change authorized officer'
- elif amd.type == 'Banking Info':
- amd_type = 'Change banking info'
- elif amd.type == 'Agreement Changes':
- amd_type = 'Amend existing clause'
- elif amd.type == 'Additional Clauses':
- amd_type = 'Additional clause'
-
- amendment_number = helper_amendment_number(amd, AgreementAmendmentLog)
- agr_amd, created = AgreementAmendment.objects.get_or_create(number=amendment_number,
- agreement=amd.agreement,
- type=amd_type,
- signed_amendment=amd.signed_document,
- signed_date=amd.amended_at)
- if created:
- print('{}-{}'.format(agr_amd.number, agr_amd.agreement))
-
- def copy_pca_results_to_intervention():
- for pca in PCA.objects.all():
- result_ids = pca.indicators.order_by().values_list('result__id', flat=True).distinct()
- for result_id in result_ids:
- result = Result.objects.get(id=result_id)
- ram_inds = pca.indicators.filter(result=result)
- indicators = []
- for ram_ind in ram_inds:
- if ram_ind.indicator:
- indicators.append(ram_ind.indicator)
- try:
- intervention = Intervention.objects.get(number=pca.number)
- except Intervention.DoesNotExist:
- log_to_file('copy_pca_results_to_intervention: Indervention.DoesNotExist', pca.id, pca.number)
- continue
- irl, created = InterventionResultLink.objects.get_or_create(intervention=intervention, cp_output=result)
- irl.ram_indicators.add(*indicators)
-
- def copy_pca_attachments_to_intervention():
- for pca_file in PCAFile.objects.all():
- try:
- intervention = Intervention.objects.get(number=pca_file.pca.number)
- except Intervention.DoesNotExist:
- print(pca_file.pca.number)
- continue
- InterventionAttachment.objects.get_or_create(intervention=intervention,
- type=pca_file.type,
- attachment=pca_file.attachment)
-
- def copy_pca_budgets_to_intervention():
- for pca in PCA.objects.all():
- pb_years = pca.budget_log.values_list('year', flat=True).distinct()
- if not pb_years:
- continue
- try:
- intervention = Intervention.objects.get(number=pca.number)
- except Intervention.DoesNotExist:
- log_to_file('copy_pca_budgets_to_intervention: Intervention.DoesNotExist', pca.id, pca.number)
- continue
- print(pb_years)
- for pb_year in pb_years:
- if pb_year:
- pb = pca.budget_log.filter(year=pb_year).order_by('-created').first()
- InterventionBudget.objects.get_or_create(intervention=intervention,
- partner_contribution=pb.partner_contribution,
- unicef_cash=pb.unicef_cash,
- in_kind_amount=pb.in_kind_amount,
- year=pb.year,
- total=pb.total)
-
- def copy_pca_sector_locations_to_intervention():
- for pca in PCA.objects.all():
- sector_ids = pca.locations.order_by().values_list('sector__id', flat=True).distinct()
- for sector_id in sector_ids:
- if not sector_id:
- continue
- sector = Sector.objects.get(id=sector_id)
- gwpc_locations = pca.locations.filter(sector=sector).all()
- locations = []
- for gwpc_loc in gwpc_locations:
- if gwpc_loc.location:
- locations.append(gwpc_loc.location)
- try:
- intervention = Intervention.objects.get(number=pca.number)
- except Intervention.DoesNotExist:
- log_to_file('copy_pca_sector_locations_to_intervention: Intervention.DoesNotExist', pca.id, pca.number)
- continue
- isl, created = InterventionSectorLocationLink.objects.get_or_create(intervention=intervention,
- sector=sector)
- isl.locations.add(*locations)
-
- def copy_pca_supply_plan_to_intervention():
- for sp in SupplyPlan.objects.all():
- try:
- intervention = Intervention.objects.get(number=sp.partnership.number)
- except Intervention.DoesNotExist:
- log_to_file('copy_pca_supply_plan_to_intervention: Intervention.DoesNotExist', sp.partnership.id, sp.partnership.number)
- continue
- sp.intervention = intervention
- sp.save()
-
- def copy_pca_distribution_plan_to_intervention():
- for dp in DistributionPlan.objects.all():
- if SupplyPlan.objects.filter(intervention=dp.intervention, item=dp.item).count():
- try:
- intervention = Intervention.objects.get(number=dp.partnership.number)
- except Intervention.DoesNotExist:
- log_to_file('copy_pca_distribution_plan_to_intervention: Indervention.DoesNotExist', dp.partnership.id,
- dp.partnership.number)
-
- continue
- dp.intervention = intervention
- dp.save()
-
- copy_pca_fields_to_intervention()
- agreement_amd_copy()
- copy_pca_results_to_intervention()
- copy_pca_attachments_to_intervention()
- copy_pca_budgets_to_intervention()
- copy_pca_sector_locations_to_intervention()
- copy_pca_supply_plan_to_intervention()
- copy_pca_distribution_plan_to_intervention()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0012_partnerorganization_hact_values'),
- ]
-
- operations = [
- migrations.RunPython(
- after_partner_migrations, reverse_code=reverse
- ),
-
- ]
diff --git a/EquiTrack/partners/migrations/0014_auto_20170127_2140.py b/EquiTrack/partners/migrations/0014_auto_20170127_2140.py
deleted file mode 100644
index 3c027901a..000000000
--- a/EquiTrack/partners/migrations/0014_auto_20170127_2140.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-27 19:40
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-def reverse(apps, schema_editor):
- pass
-
-def agr_copy_type_tmp(apps, schema_editor):
- AgreementAmendment = apps.get_model('partners', 'AgreementAmendment')
- for amd in AgreementAmendment.objects.all():
- amd.tmp_type = amd.type
- amd.save()
- print('saved amd {}'.format(amd.id))
-
-def agr_copy_tmp_arr_type(apps, schema_editor):
- AgreementAmendment = apps.get_model('partners', 'AgreementAmendment')
- amendments = AgreementAmendment.objects.all()
- for amd in amendments:
- amd.type = [amd.tmp_type]
- amd.save()
- print('saved amd {}'.format(amd.id))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0013_auto_20170127_0106'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='agreementamendment',
- name='tmp_type',
- field=models.CharField(blank=True,
- choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'),
- ('CP extension', 'Extension of Country Programme Cycle'),
- ('Change authorized officer', 'Change Authorized Officer'),
- ('Change banking info', 'Banking Information'),
- ('Additional clause', 'Additional Clause'),
- ('Amend existing clause', 'Amend Existing Clause')], max_length=64,
- null=True),
- ),
- migrations.RunPython(
- agr_copy_type_tmp, reverse_code=reverse
- ),
- migrations.RemoveField(
- model_name='agreementamendment',
- name='type',
- ),
- migrations.AddField(
- model_name='agreementamendment',
- name='type',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(
- choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'),
- ('CP extension', 'Extension of Country Programme Cycle'),
- ('Change authorized officer', 'Change Authorized Officer'),
- ('Change banking info', 'Banking Information'), ('Additional clause', 'Additional Clause'),
- ('Amend existing clause', 'Amend Existing Clause')], max_length=64), null=True, size=None),
- ),
- migrations.RunPython(
- agr_copy_tmp_arr_type, reverse_code=reverse
- ),
-
- ]
diff --git a/EquiTrack/partners/migrations/0015_auto_20170127_2140.py b/EquiTrack/partners/migrations/0015_auto_20170127_2140.py
deleted file mode 100644
index cef710d1f..000000000
--- a/EquiTrack/partners/migrations/0015_auto_20170127_2140.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-27 19:40
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0014_auto_20170127_2140'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='agreementamendment',
- name='tmp_type',
- ),
- migrations.AlterField(
- model_name='agreementamendment',
- name='type',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(
- choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'),
- ('CP extension', 'Extension of Country Programme Cycle'),
- ('Change authorized officer', 'Change Authorized Officer'),
- ('Change banking info', 'Banking Information'), ('Additional clause', 'Additional Clause'),
- ('Amend existing clause', 'Amend Existing Clause')], max_length=64), size=None),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0016_auto_20170130_1630.py b/EquiTrack/partners/migrations/0016_auto_20170130_1630.py
deleted file mode 100644
index 017ab999a..000000000
--- a/EquiTrack/partners/migrations/0016_auto_20170130_1630.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-30 14:30
-from __future__ import unicode_literals
-
-import logging
-
-from django.db import migrations
-
-log = logging.getLogger(__name__)
-
-
-def reverse(apps, schema_editor):
- pass
-
-
-def bank_details_to_partner(apps, schema_editor):
- BankDetails = apps.get_model('partners', 'BankDetails')
- bds = BankDetails.objects.all()
- if bds.count() > 0:
- for bd in bds:
- if not bd.partner_organization:
- bd.partner_organization = bd.agreement.partner
- log.info(bd.partner_organization.name)
- bd.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0015_auto_20170127_2140'),
- ]
-
- operations = [
- migrations.RunPython(
- bank_details_to_partner, reverse_code=reverse
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0017_remove_bankdetails_agreement.py b/EquiTrack/partners/migrations/0017_remove_bankdetails_agreement.py
deleted file mode 100644
index 307bb8ba9..000000000
--- a/EquiTrack/partners/migrations/0017_remove_bankdetails_agreement.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-31 16:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0016_auto_20170130_1630'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='bankdetails',
- name='agreement',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0018_auto_20170203_1843.py b/EquiTrack/partners/migrations/0018_auto_20170203_1843.py
deleted file mode 100644
index 3d3e9183d..000000000
--- a/EquiTrack/partners/migrations/0018_auto_20170203_1843.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-03 16:43
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations
-import partners.models
-
-
-def activity_default():
- return {}
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0017_remove_bankdetails_agreement'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='activities_list',
- ),
- migrations.AddField(
- model_name='governmentinterventionresult',
- name='activity',
- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=activity_default, null=True),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0019_auto_20170208_2158.py b/EquiTrack/partners/migrations/0019_auto_20170208_2158.py
deleted file mode 100644
index 7cd86fdca..000000000
--- a/EquiTrack/partners/migrations/0019_auto_20170208_2158.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-08 19:58
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0018_auto_20170203_1843'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='AgreementAmendmentType',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('type', models.CharField(choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'), ('CP extension', 'Extension of Country Programme Cycle'), ('Change authorized officer', 'Change Authorized Officer'), ('Change banking info', 'Banking Information'), ('Additional clause', 'Additional Clause'), ('Amend existing clause', 'Amend Existing Clause')], max_length=64)),
- ('label', models.TextField(blank=True, null=True)),
- ('officer', models.IntegerField(blank=True, null=True)),
- ('bank_info', models.TextField(blank=True, null=True)),
- ('legal_name_of_ip', models.CharField(blank=True, max_length=255, null=True)),
- ('cp_cycle_end', models.DateField(blank=True, null=True)),
- ('additional_clauses', models.TextField(blank=True, null=True)),
- ('existing_clause_amended', models.TextField(blank=True, null=True)),
- ],
- ),
- migrations.RemoveField(
- model_name='agreementamendment',
- name='type',
- ),
- migrations.AddField(
- model_name='agreementamendmenttype',
- name='agreement_amendment',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendment_types', to='partners.AgreementAmendment'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0020_governmentinterventionresultactivity.py b/EquiTrack/partners/migrations/0020_governmentinterventionresultactivity.py
deleted file mode 100644
index a59b0f8b1..000000000
--- a/EquiTrack/partners/migrations/0020_governmentinterventionresultactivity.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-13 21:50
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0019_auto_20170208_2158'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='GovernmentInterventionResultActivity',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('code', models.CharField(max_length=36)),
- ('description', models.CharField(max_length=1024)),
- ('intervention_result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='result_activities', to='partners.GovernmentInterventionResult')),
- ],
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0021_interventionbudget_currency.py b/EquiTrack/partners/migrations/0021_interventionbudget_currency.py
deleted file mode 100644
index 5a24d07a4..000000000
--- a/EquiTrack/partners/migrations/0021_interventionbudget_currency.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-15 22:36
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0005_auto_20170209_2353'),
- ('partners', '0020_governmentinterventionresultactivity'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='interventionbudget',
- name='currency',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='publics.Currency'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0022_auto_20170301_0527.py b/EquiTrack/partners/migrations/0022_auto_20170301_0527.py
deleted file mode 100644
index f7845573e..000000000
--- a/EquiTrack/partners/migrations/0022_auto_20170301_0527.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-01 03:27
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0021_interventionbudget_currency'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='title',
- field=models.CharField(blank=True, max_length=64L, null=True),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0023_auto_20170301_2324.py b/EquiTrack/partners/migrations/0023_auto_20170301_2324.py
deleted file mode 100644
index b87fe7cba..000000000
--- a/EquiTrack/partners/migrations/0023_auto_20170301_2324.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-01 21:24
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0022_auto_20170301_0527'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='partnerorganization',
- name='cso_type',
- field=models.CharField(blank=True, choices=[('International', 'International'), ('National', 'National'), ('Community Based Organization', 'Community Based Organization'), ('Academic Institution', 'Academic Institution')], max_length=50, null=True, verbose_name='CSO Type'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='shared_with',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN', 'UN'), ('UN Women', 'UN Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=20), blank=True, null=True, size=None),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0024_auto_20170404_2041.py b/EquiTrack/partners/migrations/0024_auto_20170404_2041.py
deleted file mode 100644
index 6571b137c..000000000
--- a/EquiTrack/partners/migrations/0024_auto_20170404_2041.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-04 17:41
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-from django.db.models import Count
-
-def reverse(apps, schema_editor):
- pass
-
-def gov_int_unique_reference_number(apps, schema_editor):
- pass
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0023_auto_20170301_2324'),
- ]
-
- operations = [
- migrations.RunPython(
- gov_int_unique_reference_number, reverse_code=reverse),
-
- migrations.AlterField(
- model_name='governmentintervention',
- name='number',
- field=models.CharField(blank=True, max_length=45L, unique=True, verbose_name='Reference Number'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0025_auto_20170412_1312.py b/EquiTrack/partners/migrations/0025_auto_20170412_1312.py
deleted file mode 100644
index c59a107e3..000000000
--- a/EquiTrack/partners/migrations/0025_auto_20170412_1312.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-12 13:12
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0024_auto_20170404_2041'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='phone',
- field=models.CharField(blank=True, max_length=64L, null=True),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0026_auto_20170428_1045.py b/EquiTrack/partners/migrations/0026_auto_20170428_1045.py
deleted file mode 100644
index 6c23045c2..000000000
--- a/EquiTrack/partners/migrations/0026_auto_20170428_1045.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-28 10:45
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0025_auto_20170412_1312'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='pca',
- options={'ordering': ['-created_at'], 'verbose_name': 'Old Intervention', 'verbose_name_plural': 'Old Interventions'},
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0027_auto_20170503_1430.py b/EquiTrack/partners/migrations/0027_auto_20170503_1430.py
deleted file mode 100644
index 226ae02f9..000000000
--- a/EquiTrack/partners/migrations/0027_auto_20170503_1430.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-03 14:30
-from __future__ import unicode_literals
-import re
-from django.db import migrations
-
-
-def reverse(apps, schema_editor):
- pass
-
-def copy_pca_fr_number_to_intervention(apps, schema_editor):
- PCA = apps.get_model('partners', 'PCA')
- Intervention = apps.get_model('partners', 'Intervention')
-
- for pca in PCA.objects.filter(fr_number__isnull=False).exclude(fr_number__exact=''):
- try:
- intervention = Intervention.objects.get(number=pca.number)
- # if not intervention.fr_numbers:
- fr_numbers = re.split(', |;|/', pca.fr_number)
- intervention.fr_numbers = fr_numbers
- intervention.save()
- print(intervention.fr_numbers)
- except Intervention.DoesNotExist:
- print('intervention type {} does not exist'.format(pca.partnership_type))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0026_auto_20170428_1045'),
- ]
-
- operations = [
- migrations.RunPython(
- copy_pca_fr_number_to_intervention, reverse_code=reverse
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0028_auto_20170517_1516.py b/EquiTrack/partners/migrations/0028_auto_20170517_1516.py
deleted file mode 100644
index ce2a56924..000000000
--- a/EquiTrack/partners/migrations/0028_auto_20170517_1516.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-17 15:16
-from __future__ import unicode_literals
-import logging
-from django.db import migrations, models
-
-
-def reverse(apps, schema_editor):
- pass
-
-
-def migrate_assessments(apps, schema_editor):
- Assessment = apps.get_model('partners', 'Assessment')
- # migrating high risk assumed types to other
- assesments = Assessment.objects.filter(type="High Risk Assumed")
- for assesment in assesments:
- assesment.type = "Other"
- assesment.save()
- logging.info("assessment id: {}".format(assesment.id))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0027_auto_20170503_1430'),
- ]
-
- operations = [
- migrations.RunPython(
- migrate_assessments, reverse_code=reverse
- ),
- migrations.AlterField(
- model_name='assessment',
- name='type',
- field=models.CharField(choices=[('Micro Assessment', 'Micro Assessment'), ('Simplified Checklist', 'Simplified Checklist'), ('Scheduled Audit report', 'Scheduled Audit report'), ('Special Audit report', 'Special Audit report'), ('Other', 'Other')], max_length=50),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0029_auto_20170517_2017.py b/EquiTrack/partners/migrations/0029_auto_20170517_2017.py
deleted file mode 100644
index 95c6206ba..000000000
--- a/EquiTrack/partners/migrations/0029_auto_20170517_2017.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-17 20:17
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import partners.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0028_auto_20170517_1516'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='agreement',
- name='attached_agreement',
- field=models.FileField(blank=True, max_length=1024, upload_to=partners.models.get_agreement_path),
- ),
- migrations.AlterField(
- model_name='agreementamendment',
- name='signed_amendment',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_agreement_amd_file_path),
- ),
- migrations.AlterField(
- model_name='agreementamendmentlog',
- name='signed_document',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_agreement_amd_file_path),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='report',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_assesment_path),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='prc_review_document',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_prc_intervention_file_path),
- ),
- migrations.AlterField(
- model_name='interventionamendment',
- name='signed_amendment',
- field=models.FileField(max_length=1024, upload_to=partners.models.get_intervention_amendment_file_path),
- ),
- migrations.AlterField(
- model_name='interventionattachment',
- name='attachment',
- field=models.FileField(max_length=1024, upload_to=partners.models.get_intervention_attachments_file_path),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='core_values_assessment',
- field=models.FileField(blank=True, help_text='Only required for CSO partners', max_length=1024, null=True, upload_to='partners/core_values/'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0030_intervention_signed_pd_document.py b/EquiTrack/partners/migrations/0030_intervention_signed_pd_document.py
deleted file mode 100644
index 7da5dddac..000000000
--- a/EquiTrack/partners/migrations/0030_intervention_signed_pd_document.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-12 13:38
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import partners.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0029_auto_20170517_2017'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='intervention',
- name='signed_pd_document',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_prc_intervention_file_path),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0031_planned_budget_consolidation.py b/EquiTrack/partners/migrations/0031_planned_budget_consolidation.py
deleted file mode 100644
index 06d6cb17c..000000000
--- a/EquiTrack/partners/migrations/0031_planned_budget_consolidation.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-17 20:17
-from __future__ import unicode_literals
-
-from django.db import migrations, models, connection
-from django.db.models import Sum
-def reverse(apps, schema_editor):
- pass
-
-def migrate_planned_budget(apps, schema_editor):
- InterventionBudget = apps.get_model('partners', 'InterventionBudget')
- Intervention = apps.get_model('partners', 'Intervention')
- Workspace = apps.get_model('users', 'Country')
- current_workspace = Workspace.objects.get(schema_name=connection.schema_name)
-
- if not current_workspace.schema_name == 'test':
- assert current_workspace.local_currency is not None
-
- local_currency = current_workspace.local_currency
- interventions = Intervention.objects.all()
- print("Total interventions {}".format(interventions.count()))
- count = 0
- for i in interventions:
- if i.planned_budget.exists():
- pb = i.planned_budget.aggregate(
- total_partner_contribution=Sum('partner_contribution'),
- total_unicef_cash=Sum('unicef_cash'),
- total_in_kind_amount=Sum('in_kind_amount'),
- total_partner_contribution_local=Sum('partner_contribution_local'),
- total_unicef_cash_local=Sum('unicef_cash_local'),
- total_in_kind_amount_local=Sum('in_kind_amount_local')
- )
- currency = i.planned_budget.first().currency or local_currency
- i.planned_budget.all().delete()
-
- new_planned_budget = InterventionBudget(
- intervention=i,
- partner_contribution=pb['total_partner_contribution'],
- unicef_cash=pb['total_unicef_cash'],
- in_kind_amount=pb['total_in_kind_amount'],
- partner_contribution_local=pb['total_partner_contribution_local'],
- unicef_cash_local=pb['total_unicef_cash_local'],
- in_kind_amount_local=pb['total_in_kind_amount_local'],
- total=pb['total_partner_contribution'] + pb['total_in_kind_amount'] + pb['total_unicef_cash'],
- currency=currency,
- )
- new_planned_budget.save()
- count += 1
- else:
- new_planned_budget = InterventionBudget(
- intervention=i,
- partner_contribution=0,
- unicef_cash=0,
- in_kind_amount=0,
- partner_contribution_local=0,
- unicef_cash_local=0,
- in_kind_amount_local=0,
- currency=local_currency,
- total=0
- )
- new_planned_budget.save()
-
- print('Updated automatically {}'.format(count))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0030_intervention_signed_pd_document'),
- ('users', '0008_workspacecounter'),
- ('publics', '0024_auto_20170526_1600')
- ]
- operations = [
- migrations.RunPython(
- migrate_planned_budget, reverse_code=reverse),
- ]
-
diff --git a/EquiTrack/partners/migrations/0032_auto_20170612_1536.py b/EquiTrack/partners/migrations/0032_auto_20170612_1536.py
deleted file mode 100644
index 40d4deeb1..000000000
--- a/EquiTrack/partners/migrations/0032_auto_20170612_1536.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-12 15:36
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0031_planned_budget_consolidation'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='interventionbudget',
- name='intervention',
- field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='planned_budget', to='partners.Intervention'),
- ),
- migrations.AlterUniqueTogether(
- name='interventionbudget',
- unique_together=set([]),
- ),
- migrations.RemoveField(
- model_name='interventionbudget',
- name='year',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0033_auto_20170614_1831.py b/EquiTrack/partners/migrations/0033_auto_20170614_1831.py
deleted file mode 100644
index 9590551cf..000000000
--- a/EquiTrack/partners/migrations/0033_auto_20170614_1831.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-14 18:31
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0010_countryprogramme_invalid'),
- ('partners', '0032_auto_20170612_1536'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='governmentintervention',
- name='result_structure',
- ),
- migrations.RemoveField(
- model_name='intervention',
- name='hrp',
- ),
- migrations.RemoveField(
- model_name='pca',
- name='result_structure',
- ),
- migrations.AddField(
- model_name='intervention',
- name='country_programme',
- field=models.ForeignKey(blank=True, help_text='Which Country Programme does this Intervention belong to?', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='interventions', to='reports.CountryProgramme'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0034_fr_numbers.py b/EquiTrack/partners/migrations/0034_fr_numbers.py
deleted file mode 100644
index 6d4a94247..000000000
--- a/EquiTrack/partners/migrations/0034_fr_numbers.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-17 20:17
-from __future__ import unicode_literals, print_function
-
-from django.db import migrations, models, connection
-from django.db.models import Sum
-
-def reverse(apps, schema_editor):
- pass
-
-def migrate_frs(apps, schema_editor):
- def printtf(*args):
- print('\n'.join(args))
- f = open('migration_errors.txt', 'a')
- print('\n'.join(args), file=f)
- f.close()
-
- FundsReservationHeader = apps.get_model('funds', 'FundsReservationHeader')
- Intervention = apps.get_model('partners', 'Intervention')
- printtf('', connection.schema_name)
- for i in Intervention.objects.all():
- fr_numbers = i.fr_numbers if i.fr_numbers else []
- for fr in fr_numbers:
- try:
- fr_obj = FundsReservationHeader.objects.get(fr_number=fr)
- except FundsReservationHeader.DoesNotExist:
- if i.status != 'draft':
- # workaround in the local db until records are fixed in production
- printtf('{}, {} FR not found for Intervention {}'.format(i.status, fr, i.id))
- i.fr_numbers = None
- i.save()
- # raise BaseException('No FR found')
- else:
- # if intervention is in Draft, we don't care.. we're removing FRs, let the users re-add
- printtf('{}, {} FR not found for Intervention {}'.format(i.status, fr, i.id))
- i.fr_numbers = None
- i.save()
- else:
- if fr_obj.intervention and fr_obj.intervention.id != i.id:
- printtf('#### {}, FR {} connected to a different Intervention {}... current Intervention {}'.
- format(i.status, fr_obj.fr_number, fr_obj.intervention.id, i.id))
- # workaround in the local db until records are fixed in production
- i.fr_numbers = None
- i.save()
- # raise BaseException('FR Has been used')
- else:
- fr_obj.intervention = i
- fr_obj.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0033_auto_20170614_1831'),
- ('funds', '0004_auto_20170620_0133')
- ]
- operations = [
- migrations.RunPython(
- migrate_frs, reverse_code=reverse),
- ]
-
diff --git a/EquiTrack/partners/migrations/0035_remove_intervention_fr_numbers.py b/EquiTrack/partners/migrations/0035_remove_intervention_fr_numbers.py
deleted file mode 100644
index 0d96d93ab..000000000
--- a/EquiTrack/partners/migrations/0035_remove_intervention_fr_numbers.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-23 17:40
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0034_fr_numbers'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='intervention',
- name='fr_numbers',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0036_auto_20170627_1850.py b/EquiTrack/partners/migrations/0036_auto_20170627_1850.py
deleted file mode 100644
index 9e7410c27..000000000
--- a/EquiTrack/partners/migrations/0036_auto_20170627_1850.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-27 18:50
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django_fsm
-import partners.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0035_remove_intervention_fr_numbers'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='agreement',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('cancelled', 'Cancelled'), ('active', 'Active'), ('signed', 'Signed'), ('ended', 'Ended'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0037_auto_20170627_1854.py b/EquiTrack/partners/migrations/0037_auto_20170627_1854.py
deleted file mode 100644
index 64b73288e..000000000
--- a/EquiTrack/partners/migrations/0037_auto_20170627_1854.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-27 16:00
-from __future__ import unicode_literals, print_function
-
-from django.db import migrations, models
-
-
-def reverse(apps, schema_editor):
- pass
-
-
-def migrate_agreement_status(apps, schema_editor):
- Agreement = apps.get_model('partners', 'Agreement')
- agreements = Agreement.objects.filter(status="active").update(status="signed")
- print(agreements)
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0036_auto_20170627_1850'),
- ]
-
- operations = [
- migrations.AlterModelManagers(
- name='agreement',
- managers=[
- ],
- ),
-
- migrations.RunPython(
- migrate_agreement_status, reverse_code=reverse),
-
- migrations.AlterModelManagers(
- name='agreement',
- managers=[
- ('view_objects', models.manager.Manager()),
- ],
- ),
-
- ]
diff --git a/EquiTrack/partners/migrations/0038_auto_20170628_1808.py b/EquiTrack/partners/migrations/0038_auto_20170628_1808.py
deleted file mode 100644
index 0f5db6d53..000000000
--- a/EquiTrack/partners/migrations/0038_auto_20170628_1808.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-17 20:17
-from __future__ import unicode_literals
-from django.db import migrations, models, connection
-
-
-def reverse(apps, schema_editor):
- pass
-
-
-def migrate_cps(apps, schema_editor):
- CountryProgramme = apps.get_model('reports', 'CountryProgramme')
- Agreement = apps.get_model('partners', 'Agreement')
- Intervention = apps.get_model('partners', 'Intervention')
-
- Workspace = apps.get_model('users', 'Country')
- current_workspace = Workspace.objects.get(schema_name=connection.schema_name)
-
- if current_workspace.schema_name == 'palestine':
- cps = CountryProgramme.objects.filter(invalid=False, wbs__contains='/PC/')
- else:
- cps = CountryProgramme.objects.filter(invalid=False, wbs__contains='/A0/')
-
- for cp in cps:
- agreements = Agreement.objects.filter(start__gte=cp.from_date,
- start__lte=cp.to_date,).exclude(
- agreement_type__in=['MOU']).update(country_programme=cp)
-
- mou_agreements = Agreement.objects.filter(country_programme__isnull=False,
- agreement_type__in=['MOU']).update(country_programme=None)
-
- interventions = Intervention.objects.filter(start__gte=cp.from_date,
- start__lte=cp.to_date,)
- for intervention in interventions:
- wrong_cp = []
- for rl in intervention.result_links.all():
- if rl.cp_output.country_programme != cp:
- wrong_cp.append(rl.cp_output.wbs)
- if len(wrong_cp) > 0:
- # raise BaseException("PD [{}] STATUS [{}] CP [{}] has wrongly mapped outputs {}".format(
- # intervention.id, intervention.status, cp.wbs, wrong_cp))
- print("PD [P{}] STATUS [{}] CP [{}] has wrongly mapped outputs {}".format(intervention.id, intervention.status, cp.wbs, wrong_cp))
- intervention.country_programme = cp
- intervention.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0037_auto_20170627_1854'),
- ('reports', '0011_auto_20170614_1831'),
- ('users', '0008_workspacecounter')
- ]
-
- operations = [
- # This is required or 'apps.get_model' will fail in the end
- migrations.AlterModelManagers(
- name='agreement',
- managers=[
- ],
- ),
-
- migrations.RunPython(
- migrate_cps, reverse_code=reverse),
-
- migrations.AlterModelManagers(
- name='agreement',
- managers=[
- ('view_objects', models.manager.Manager()),
- ],
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0039_auto_20170629_1447.py b/EquiTrack/partners/migrations/0039_auto_20170629_1447.py
deleted file mode 100644
index aad9bd1cc..000000000
--- a/EquiTrack/partners/migrations/0039_auto_20170629_1447.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-29 14:47
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models, connection
-
-TYPE_MAP = {
- 'CPR': 'Change in Programme Result',
- 'CPF': 'Change in Population Focus',
- 'CGC': 'Change in Georgraphical Coverage',
- 'CTBGT20': 'Change in Total Budget >20%',
- 'CTBLT20': 'Change in Total Budget <=20%',
- 'CABLT20': 'Changes in Activity Budget <=20% - No Change in Total Budget',
- 'CABGT20': 'Changes in Activity Budget >20% - No Change in Total Budget - Prior approval in authorized FACE',
- 'CABGT20FACE': 'Changes in Activity Budget >20% - No Change in Total Budget - Reporting at FACE',
-}
-
-MAP = {
- 'default_schema': {
- 'CPR': 'result',
- 'CPF': 'other',
- 'CGC': 'other',
- 'CTBGT20': 'budget',
- 'CTBLT20': 'budget',
- 'CABLT20': 'budget',
- 'CABGT20': 'budget',
- 'CABGT20FACE': 'budget'
- },
-}
-
-def reverse(apps, schema_editor):
- raise BaseException('Cannot migrate this backwards')
-
-def default_list_to_other():
- return ['other']
-
-def get_mapped_value(value):
- schema_name = connection.schema_name
- try:
- schema_map = MAP[schema_name]
- except KeyError:
- schema_map = MAP['default_schema']
-
- return schema_map[value]
-
-def migrate_amendment_types(apps, schema_editor):
- InterventionAmendment = apps.get_model('partners', 'InterventionAmendment')
- no = 0
- for i in InterventionAmendment.objects.all():
- no += 1
- value = get_mapped_value(i.type)
- i.types = [i.type]
- if value == 'other':
- i.other_description = TYPE_MAP[i.type]
- i.save()
-
- print('Updated Intervention Amendments: {}'.format(no))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0038_auto_20170628_1808'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='interventionamendment',
- name='types',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(
- choices=[('dates', 'Dates'), ('results', 'Results'), ('budget', 'Budget'), ('other', 'Other')],
- max_length=50), null=True, size=None),
- ),
- migrations.AddField(
- model_name='interventionamendment',
- name='other_description',
- field=models.CharField(max_length=512, null=True, blank=True)
- ),
- migrations.RunPython(
- migrate_amendment_types, reverse_code=reverse),
-
- migrations.AlterField(
- model_name='interventionamendment',
- name='types',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(
- choices=[('dates', 'Dates'), ('results', 'Results'), ('budget', 'Budget'), ('other', 'Other')],
- max_length=50), size=None),
- ),
- migrations.RemoveField(
- model_name='interventionamendment',
- name='type'
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0040_intervention_contingency_pd.py b/EquiTrack/partners/migrations/0040_intervention_contingency_pd.py
deleted file mode 100644
index f26c6bd01..000000000
--- a/EquiTrack/partners/migrations/0040_intervention_contingency_pd.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-06 15:00
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0039_auto_20170629_1447'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='intervention',
- name='contingency_pd',
- field=models.BooleanField(default=False),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0041_auto_20170706_1731.py b/EquiTrack/partners/migrations/0041_auto_20170706_1731.py
deleted file mode 100644
index efc4351b8..000000000
--- a/EquiTrack/partners/migrations/0041_auto_20170706_1731.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-06 17:31
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django_fsm
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0040_intervention_contingency_pd'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='intervention',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('signed', 'Signed'), ('active', 'Active'), ('ended', 'Ended'), ('closed', 'Closed'), ('implemented', 'Implemented'), ('suspended', 'Suspended'), ('terminated', 'Terminated'), ('cancelled', 'Cancelled')], default='draft', max_length=32),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0042_auto_20170707_2036.py b/EquiTrack/partners/migrations/0042_auto_20170707_2036.py
deleted file mode 100644
index cd5e1eb32..000000000
--- a/EquiTrack/partners/migrations/0042_auto_20170707_2036.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-07 20:36
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations, models
-import django_fsm
-
-def reverse(apps, schema_editor):
- raise BaseException('cannot reverse this migration')
-
-
-def migrate_interventions_by_valid_status(apps, schema_editor):
- # Migrate the statuses that can be migrated
- # for remediation after all migrations run... run a script to re-validate all interventions
- # and let the auto-transitions update the records
-
- Intervention = apps.get_model('partners', 'Intervention')
-
- closed_interventions = Intervention.objects.filter(status='implemented').\
- update(status='closed', metadata={'old_status': 'implemented',
- 'migrated': True})
-
- cancelled = Intervention.objects.filter(status='cancelled').\
- update(status='draft', metadata={'old_status': 'cancelled',
- 'migrated': True})
-
- print('Interventions Updated to implemented from closed: {}'.format(closed_interventions))
- print('Interventions moved to Draft from cancelled: {}'.format(cancelled))
-
-
-
-
-def remove_old_agreements(apps, schema_editor):
- IC = 'IC'
- AWP = 'AWP'
- Agreement = apps.get_model('partners', 'Agreement')
- deleted = Agreement.objects.filter(agreement_type__in=[IC, AWP]).delete()
- print('IC and AWP Agreements deleted: {}'.format(deleted))
-
-
-def migrate_agreements_by_status(apps, schema_editor):
- Agreement = apps.get_model('partners', 'Agreement')
- agreements_migrated = Agreement.objects.filter(status='active').update(status='signed')
- agreements_draft = Agreement.objects.filter(status='cancelled').update(status='draft')
-
- print('Agreements Updated to signed from active: {}'.format(agreements_migrated))
- print('Agreements moved to Draft from cancelled: {}'.format(agreements_draft))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0041_auto_20170706_1731'),
- ]
-
- operations = [
- migrations.AlterModelManagers(
- name='agreement',
- managers=[
- ],
- ),
- migrations.AddField(
- model_name='intervention',
- name='metadata',
- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True),
- ),
- migrations.RunPython(
- migrate_interventions_by_valid_status, reverse_code=reverse),
- migrations.RunPython(
- remove_old_agreements, reverse_code=reverse),
- migrations.RunPython(
- migrate_agreements_by_status, reverse_code=reverse),
- migrations.AlterField(
- model_name='agreement',
- name='agreement_type',
- field=models.CharField(choices=[('PCA', 'Programme Cooperation Agreement'), ('SSFA', 'Small Scale Funding Agreement'), ('MOU', 'Memorandum of Understanding')], max_length=10),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('signed', 'Signed'), ('ended', 'Ended'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='status',
- field=django_fsm.FSMField(blank=True,
- choices=[('draft', 'Draft'), ('signed', 'Signed'), ('active', 'Active'),
- ('ended', 'Ended'), ('closed', 'Closed'), ('suspended', 'Suspended'),
- ('terminated', 'Terminated')], default='draft', max_length=32),
- ),
- migrations.AlterModelManagers(
- name='agreement',
- managers=[
- ('view_objects', models.manager.Manager()),
- ],
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0043_auto_20170711_1610.py b/EquiTrack/partners/migrations/0043_auto_20170711_1610.py
deleted file mode 100644
index 5c4fbb6f3..000000000
--- a/EquiTrack/partners/migrations/0043_auto_20170711_1610.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-03 15:18
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-MAP = {
- 'Additional clause': 'Change in clause',
- 'Amend existing clause': 'Change in clause'
-}
-
-
-def reverse(apps, schema_editor):
- pass
- # raise BaseException('Cannot migrate this backwards')
-
-
-def migrate_amendment_types(apps, schema_editor):
- AgreementAmendment = apps.get_model('partners', 'AgreementAmendment')
- no = 0
- for agr in AgreementAmendment.objects.all():
- no += 1
- agr.types = [MAP.get(t.type, t.type) for t in agr.amendment_types.all()]
- agr.save()
-
- print('Updated Agreements Amendments: {}'.format(no))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0042_auto_20170707_2036'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='agreementamendment',
- name='types',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(
- choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'),
- ('CP extension', 'Extension of Country Programme Cycle'),
- ('Change authorized officer', 'Change Authorized Officer(s)'),
- ('Change banking info', 'Banking Information'), ('Change in clause', 'Change in clause')],
- max_length=50), null=True, size=None),
- ),
-
- migrations.RunPython(
- migrate_amendment_types, reverse_code=reverse),
-
- migrations.AlterField(
- model_name='agreementamendment',
- name='types',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(
- choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'),
- ('CP extension', 'Extension of Country Programme Cycle'),
- ('Change authorized officer', 'Change Authorized Officer(s)'),
- ('Change banking info', 'Banking Information'), ('Change in clause', 'Change in clause')],
- max_length=50), size=None),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0044_auto_20170711_1611.py b/EquiTrack/partners/migrations/0044_auto_20170711_1611.py
deleted file mode 100644
index 1315bdf09..000000000
--- a/EquiTrack/partners/migrations/0044_auto_20170711_1611.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-11 16:11
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0043_auto_20170711_1610'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='agreementamendmenttype',
- name='agreement_amendment',
- ),
- migrations.DeleteModel(
- name='AgreementAmendmentType',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0045_auto_20170714_1738.py b/EquiTrack/partners/migrations/0045_auto_20170714_1738.py
deleted file mode 100644
index 5a661b177..000000000
--- a/EquiTrack/partners/migrations/0045_auto_20170714_1738.py
+++ /dev/null
@@ -1,257 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-14 17:38
-from __future__ import unicode_literals
-
-from django.db import migrations, models, connection, transaction
-
-MAPPER = {
- 'Sudan':
- {'Correspondence': ['Letter of Termination'],
- 'Other': ['Partner selection', 'PRC form', 'Others',
- 'Third party monitoring report', 'Spot check Report',
- 'Field trip report', 'Monthly reports from IP', 'Q-reports from IP',
- 'Amendment', 'PCA checklist', 'Programme Document Amendment', 'Annex G PRC form',
- 'ADRA PD1 EDU Amendment 1 budget signed', 'ADRA PD1 EDU Amendment 1 signed',
- 'ADRA PD1 EDU budget signed', 'Programme Document', 'Situation Monitoring', 'Programme Document budget',
- 'Programme Document signed', 'AlAlag PD 1 CP signed', 'test', 'HAD final Budget', 'HAD Proposal',
- 'DSRI Budget', 'DSRI Proposal', 'SOL Busget', 'SOL Proposal', 'KSCS Proposal', 'KCSC Budget',
- 'KYCCB Budget', 'KYCCB Proposal', 'SSFA FPDO Budget', 'SSFA FPDO Proposal', 'Budget', 'Proposal',
- 'RAFA Final Budget', 'RAFA Proposal', 'Almanar Budget', 'Almanar Proposal', 'CIS Budget', 'CIS Proposal',
- 'Oxfam Budget', 'Oxfam Proposal', 'Ahnar Budget', 'Ahnar Proposal', 'ZOA Budget', 'ZOA Proposal', 'AlMassar Budget',
- 'ElMassar Proposal', 'UPD Budget', 'UPD Proposal', 'WCC Amended Budget', 'WCC Amended project',
- 'WCC Budget', 'WCC Proposal', 'CDO Budget', 'CDO Propposal', 'FRDN Budget', 'FRDN Proposal',
- 'NCA Amendes Project', 'NCA Budget', 'PCA NCA Proposal', 'CAFOD Revised Budget',
- 'Revised CAFOD Proposal', 'Amended CAFOD Budget', 'Amended Proposal', 'ADRA Amended Budget',
- 'ADRA 1st Amendment', 'ADRA Budget', 'Adra Proposal', 'Amended Budget', 'SCS Amended Proposal',
- 'SCS Scanned document', 'Nutrition budget', 'Nutrition project', 'Amended budget', 'Signed amendment',
- 'Plan Budget', 'Final Plan PCA', 'Concern Budget', 'Concern Proposal', 'PBSFDHW Budget',
- 'SSFA Document', 'SCS Budget', 'SCS Proposal', 'CDF Budget', 'CDF Project', 'RAFA Budget',
- 'RAFA SSFA Format', 'Labena Budget WASH', 'Labena WASH', 'Labena Education', 'Labena Wash',
- 'Rayra Budget Final', 'SSFA Rayira Final Doc', 'HAD Budget', 'SSFA HAD Final', 'CAFOD Budget',
- 'Final TearFund Budget', 'Final PCA Document', 'Picture'],
- 'Partnership Review': ['Joint Partnership Review Report'],
- 'FACE': ['Face Form']},
- 'Nepal':
- {'Other': ['docx', 't', 'tpm', 'pdf', 'TPM', '*.jpg']},
- 'Cambodia':
- {'Progress Report': ['Progress Report'],
- 'Other': ['Programme Document', 'Picture', 'aquatabs', 'PCA', 'nfi', 'Budget', 'Amendment'],
- 'FACE': ['FACE']},
- 'Rwanda':
- {'Correspondence': ['Corresponsdence'],
- 'Final Partnership Review': ['Final Partnership Review'],
- 'FACE': ['FACE'],
- 'Progress Report': ['Progress Report'],
- 'Other': ['Other'],
- 'Partnership Review': ['Partnership Review']},
- 'Somalia':
- {'Other': ['Picture']},
- 'Palestine':
- {'Other': ['Trip Report', 'Programme Document', 'PCA']},
- 'Nigeria':
- {'Other': ['TCF 2016 Prog Doc. WASH', 'PIND 2016 Prog. Doc. WASH', 'CIDAR 2016 Prog. Doc. WASH', 'Picture',
- 'SDG report', 'Ambrose Atalor_docs', 'Emmanuel Olutunde']},
- 'China':
- {'Progress Report': ['Progress report'],
- 'Other': ['File', 'Picture', 'Picture1']},
- 'Jordan':
- {'Other': ['SSFA ToR', 'Trip Report', 'Program visit', 'Cost extension', 'NCE', 'Programme Document',
- 'Programme visit report-MOE-ECD Teachers Training']},
- 'Iraq':
- {'Progress Report': ['Spot-Check Report', 'Progress Report'],
- 'Other': ['SHPD', 'PRC Submission Form', 'Budget', 'Programme Document'],
- 'Partnership Review': ['Annual Review', 'Joint Review Report']},
- 'Liberia':
- {'Other': ['ccnccccc', 'Nimba', 'Picture']},
- 'Kyrgyzstan':
- {'Correspondence': ['Correspondence'],
- ' TA"': ['"Security Clearance'],
- 'Other': ['Security Clearance', 'SC', 'ticket 2', 'ticket 1', 'Other', 'List of Participants',
- 'Meeting Minutes', 'Meeting Protocol', 'Agenda', 'Admin Note', 'PICTURE', 'F10']},
- 'Indonesia':
- {'Other': ['Minutes of Training', 'Activity Report from STKIP', 'Picture', 'PRODOC YNS',
- 'Prodoc LP4M UNAIR', 'ProDoc STKIP Amendment 1', 'Prodoc ACF', 'ProDoc Pramuka',
- 'ProDoc WVI', 'Prodoc PKPM']},
- 'Syria Cross Border':
- {'Correspondence': ['Email Correspondence', 'Official Letter'],
- 'FACE': ['ICE Form', 'FACE Forms'],
- 'Progress Report': ['Monitoring Report', 'Progress Report (narrative)'],
- 'Other': ['SSFA_amendment', 'Amendment to PCA', 'Annex D', 'Annex G Submission Form Draft',
- 'Authorization to CSO for Procurement', 'SSFA', 'Budget', 'PRC Submission form',
- 'NFR', 'PD amendment', 'PD budget table', 'Old format PCA', 'Programmatic Assessment',
- 'PCA word Initial', 'Micro Assessment', 'Report', 'CSO Registration', 'Annex G Submission Form',
- 'Annex F CSO Identification Profile', 'Annex E Partner Declaration', 'Annex C Programme Document',
- 'PD Draft', 'Annex', 'PD Signed', 'PCA Signed', 'PCA', 'Picture', 'Trip report'],
- 'Supply/Distribution Plan': ['Supply Distribution Report', 'Supply Distribution Plan'],
- 'Partnership Review': ['Joint Partnership Review']},
- 'South Sudan':
- {'Other': ['PCA Signed Package', 'CMD-Edu-Oct16', 'CAO-CP-Oct16', 'AHA-Health-October2016',
- 'CMMB-Nutrition-No Cost Extension', 'CMMB-Nutrition-May2016', 'CCC-CP-September2016',
- 'CDOT-CP-November2016-Budget Reduction', 'CDOT-CP-April2016 Original', 'CEDS-WASH-September2016',
- 'C&D-Education-September2016', 'Picture', 'TDH-CP-Programme Document',
- 'ADRA Education Intervention Packet', 'AFOD Nutrition Intervention Packet',
- 'AFOD Cholera Intervention Packet']},
- 'Syria':
- {'Correspondence': ['extension letter', 'Extention Letters', 'Email correspondences', 'Official letter',
- 'Request letter', 'Ammendment Letter', 'MoFA letter'],
- 'Final Partnership Review': ['Closure Report'],
- 'FACE': ['Face Form', 'Payment Request', 'Face form for amendment', 'Faceform', 'Financial Statement', 'FACE'],
- 'Progress Report': ['Progress Report', 'hala reports'],
- 'Other': ['HACT Comittee meeting endoresment on amnedment', 'Tartous Trip Report - Aug 2015', 'Revised Budget', 'Revised Program Document',
- 'Cost Extension request', 'Revised PD', 'Simplified Program Document', 'PRC Submission Form',
- 'PRC Review and Recommendation', 'Micro Assesement', 'ammendment letter with ammended part of budget',
- 'closure letter from Unicef', 'End of agreement', 'Extension Budget-Education', 'PROPOSAL',
- 'Legal Document Ext.', 'Ihsan Charity', 'Summary', 'IP report 2', 'IP report 1', 'IP report',
- 'IP reports', 'alihsan', 'NCE approval letter', 'Duty travel Meeting', 'PDF', 'duty travel report',
- 'Trip Report', 'amandment doc', 'Training', 'Work Plan', 'Closure of PCA', 'Al birr Homs NCE',
- 'extension request letter', 'PCA in Arabic', 'PCA Summary', 'IECD Jaramana Final Budget',
- 'IECD Jaramana Programme Document', 'IECD Jaramana Final PCA', 'IECD Final PCA',
- 'Nour Programme Document', 'Nour Signed Budget', 'Nour signed budget', 'Nour Signed PCA',
- 'Damascus FO Duty Travel Reports', 'cancelation', 'Reason of Cancelation', 'another papers',
- 'PRC review', 'Risk Mitigation', 'Al Sham Association For health', 'liquidation second payment',
- 'Work plan', 'Identification Profile', 'First installment', 'Al Wasal EDU SSFA.pdf',
- 'No cost extension', 'Amendment budget', 'Legal Doc Arabic', 'Aoun Authorization',
- 'Aoun PD', 'Aoun Budget', '-', 'Programme document', 'IYCF Budget', 'Amendment NFR',
- 'Market Assessment', 'Manar', 'Trip report', 'Duty Travel Report', 'Report', 'Cancel the project',
- 'Liquidation first payment and request the second one', 'budget annex', 'Mitigation plan',
- 'First Payment request', 'Program Document', 'micrp assesemnt', 'Financial Note ( Amendment Request)',
- '"Justification Note "" Amendment Budget"""', 'al namaa', 'Damascus mission report', 'NFR', 'TA',
- 'Homs Trip Report', 'Programme Document', 'IP Request', 'Amended Budget', 'Extension request', 'Vendor',
- 'PCA', 'Session materials', 'Sessions materials', 'Declaration', 'SSFA Agreement', 'Technical Report',
- 'Addendum', 'Simplified Program Doc SSFA', 'Capacity and Integrity Assessment',
- 'Programatic Assessment', 'Assessment', 'Installment', 'Partner Declaration',
- 'Lattakia mission report 11 ofMay .docx', 'Risk education monitoring', 'Liquidation',
- 'Field Mission to Lattakia 29 March 2015', 'SARC PSS Hama/ mobile team', 'Hama field mission',
- 'Al Balad Al Ameen Logframe', 'Al Balad Al Ameen Propsal', 'Al Balad Al Ameen Joint Workplan',
- 'Al Balad Al Ameen Budget Agreement', 'Al Balad Al Ameen PCA 2015', 'Youth Volunteers Homs - Photos',
- 'Syria 4 years mark_ Youth Volunteers Homs - Photos', 'Revised Joint Workplan PSS 2 for Aoun',
- 'Aoun 2015 agreement budget', 'Aount PSS Revised 24-2', 'Aoun Revised PSS logframe', 'Aoun 2015 PCA',
- 'Al birr Homs H&N Checklist March 015', 'Al Birr Homs H&N Workplan March 015',
- 'Al Birr Homs H&N logfram March 015', 'Al Birr Homs H&N Budget March 015',
- 'Al Birr Homs H&N Proposal March 015', 'PCA SYR_CP_2014_100.pdf', 'SARC Hesiaa',
- 'junenile centre', 'Al Shaheed', '////', '///', '//', '/', '******', '*****', '****',
- '***', '**', '*', '--------', '------', '...................', '----------', '.........',
- '-----', '.....................', '..........', '........', '.......', '.....', '....', '...',
- '..', '.', '----', '---', 'Budget', '--', 'Meeting Minutes of Homs ESWG, 14 June2015'],
- 'Partnership Review': ['Joint PAtrnership review', 'partner joint review', 'Joint Partnership Review']},
- 'Yemen':
- {'Other': ['Others', 'Partner Declaration', 'signed Programme Document']},
- 'Myanmar':
- {'Other': ['Programme Document', 'pdf', 'Picture']},
- 'South Africa': {'Other': ['PCA Contract', 'Annex G - PCA Submission', 'Spot-Check Report', 'Annex 1 - SSFA',
- 'Umbrella Agreement', 'Annex E', 'Annex F', 'Annex C', 'Project Budget',
- 'PCA Submission Form', 'Programme Document']},
- 'Lebanon':
- {'Correspondence': ['Official Letter to Partner', 'Request Letter from Partner'],
- 'Final Partnership Review': ['Final Report'],
- 'Progress Report': ['HACT programmatic Report 2', 'HACT programmatic Report',
- 'Mid-Year Review Presentation'],
- 'Other': ['Visibilty', 'ARCPA Budget 2017', 'Briefing note', 'Programme Document', 'Handover Document',
- 'Chaat', 'Communication and Visibility', 'Case Management assessment', 'Plan', 'assessment',
- 'Hact', 'HACT for makhzoumi', 'presentation', 'kjhkj', 'hact wvl', 'Youth', 'Strategy Document',
- 'List of sites', 'Programme document', 'Focus Group Discussion', 'Power Point Presentation',
- 'Outcome doc', 'Video', 'Heartland Alliance budget', 'Trip Report Zigahta',
- 'Programme Overview', 'Presentation', 'Action plan', 'Agenda', 'Work Plan', 'MoM',
- 'Stock Count', 'NGO Briefing', 'List of schools', 'Spot Check', 'Schedule', 'Certificate',
- 'HACT', 'Picture', 'other', 'Trip report', 'MoU', 'SSFA', 'Fast Track', 'PCARC Minutes',
- 'PCA Submission', 'HRRP File', 'Amendment', 'PCA Agreement', 'Proposal', 'pca_signed',
- 'Course certificate', 'PCA cover note', 'proposal', 'Addendum', 'Logframe', 'Budget'],
- 'Supply/Distribution Plan': ['Supply Plan']},
- 'Uganda':
- {'Progress Report': ['ANNEX C_ PROGRAMME PROGRESS/FINAL REPORT'],
- 'Other': ['Amendment', 'Annex G_ PRC SUBMISSION_REVIEW_APPROVAL', 'ANNEX C_PROGRAMME WORKPLAN & BUDGET',
- 'ANNEX C_ PROGRAMME DOCUMENT'], 'Partnership Review': ['ANNEX I_JOINT PARTNERSHIP REVIEW']},
- 'Kenya':
- {'Correspondence': ['Email', 'email approval', 'Invitation letter', "Doctor's Appointment", 'Letter',
- 'Invite letter', 'Travel Plans/Email Approvals'],
- 'Other': ['Approved March Travel Plan', 'IP List', 'Trip Funding Source', 'KSM Security Clearance',
- 'Trip Report -Wilson Kisiero', 'Travel plan changes request', 'Victoria Travel plan',
- 'Travel Authorization', 'Trip Approval', 'security Clearance', 'Special Approval',
- 'Travel Approval', 'Zeinab Seurity clearnce', 'Zeinab Security clearnce', 'Garissa travel plan Q1',
- 'Zeinab security clearance', '.pdf', 'tp', 'Approval to change travel dates and itinerary',
- 'Supporting evidence', 'Budget', 'Concept note', 'security clearance', 'air ticket',
- 'Feb 2017 Travel Plan', 'travel plan', 'Agenda Items', 'security', 'Securitysigned trip',
- 'Security Clearance Embu', 'Itinerary', 'Security Clearance Tana River', 'Approved Travel Plan',
- 'Approval change of destination', 'Approval for change of trip dates', 'Samburu Trip Report',
- 'Approved Travel plan', 'Security Clearance Habaswein-Wajir', 'Trip report', 'Security Clearance',
- 'Approved change of destination', 'Air Ticket', 'Security clearance', 'Travel Authorization (TA)',
- 'Travel Plan', 'Email Approval', 'SPECIAL APPROVAL GRANTED', 'Special Approval Granted',
- 'Travel Plans/Email Approvals', 'Trial', 'LZO Bulletin', 'Trip report Ekitela',
- 'child marriage report', 'Trip Report Stanley', 'Trip Number', 'List of Schools',
- 'Special approval', 'Amolo Trip report', 'Approval for change of dates', 'Picture',
- 'Trip Report', 'Jonah', 'November Travel Plan']}}
-
-def reverse(apps, schema_editor):
- # raise BaseException('this migration cannot be reversed')
- pass
-
-@transaction.atomic
-def migrate_cps(apps, schema_editor):
- FileType = apps.get_model('partners', 'FileType')
- InterventionAttachment = apps.get_model('partners', 'InterventionAttachment')
- Workspace = apps.get_model('users', 'Country')
- tenant = Workspace.objects.get(schema_name=connection.schema_name)
- country_ft_map = MAPPER.get(tenant.name, None)
- skipped = 0
- migrated = 0
-
-
- # make sure the required file types are there
- required_file_types = ['FACE',
- 'Progress Report',
- 'Partnership Review',
- 'Final Partnership Review',
- 'Correspondence',
- 'Supply/Distribution Plan',
- 'Other']
-
- # dictionary mapping file type string to file type object
- rft = {}
- for ft in required_file_types:
- rft[ft], created = FileType.objects.get_or_create(name=ft)
-
- attachments = InterventionAttachment.objects.prefetch_related('type').all()
- total = attachments.count()
-
- if not country_ft_map:
- print('No mapper for %s'%tenant.name)
- else:
- # get all intervention file attachements
- for a in attachments:
- if a.type.name in required_file_types:
- skipped +=1
- # this means that the document is already a valid type
- continue
-
- for k in country_ft_map.keys():
- if a.type.name in country_ft_map[k]:
- migrated += 1
- a.type = rft[k]
- a.save()
-
- print('Skipped %s' % skipped)
- print('Migrated %s' % migrated)
- print('Total %s' % total)
- # check to ensure that there are no other file types that have been messed up
- if InterventionAttachment.objects.exclude(type__name__in=required_file_types).all().count():
- print('################################################### Some Attachments are still messed up')
- # raise BaseException('Attachments in {} are still messed up..please check again')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0044_auto_20170711_1611'),
- ('users', '0007_country_long_name'),
- ]
-
- operations = [
- migrations.RunPython(
- migrate_cps, reverse_code=reverse),
-
- migrations.AlterField(
- model_name='filetype',
- name='name',
- field=models.CharField(choices=[('FACE', 'FACE'), ('Progress Report', 'Progress Report'), ('Partnership Review', 'Partnership Review'), ('Correspondence', 'Correspondence'), ('Supply/Distribution Plan', 'Supply/Distribution Plan'), ('Other', 'Other')], max_length=64, unique=True),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0046_auto_20170714_1844.py b/EquiTrack/partners/migrations/0046_auto_20170714_1844.py
deleted file mode 100644
index b2ba8f05d..000000000
--- a/EquiTrack/partners/migrations/0046_auto_20170714_1844.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-14 18:44
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django.utils.timezone
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0045_auto_20170714_1738'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='interventionattachment',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='interventionattachment',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AlterModelOptions(
- name='interventionattachment',
- options={'ordering': ['-created']},
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0047_auto_20170807_1338.py b/EquiTrack/partners/migrations/0047_auto_20170807_1338.py
deleted file mode 100644
index 11d7173bf..000000000
--- a/EquiTrack/partners/migrations/0047_auto_20170807_1338.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-08-07 13:38
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0046_auto_20170714_1844'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='agreement',
- options={'ordering': ['-created']},
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0048_auto_20170823_2012.py b/EquiTrack/partners/migrations/0048_auto_20170823_2012.py
deleted file mode 100644
index ba6b147db..000000000
--- a/EquiTrack/partners/migrations/0048_auto_20170823_2012.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-08-23 20:12
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0047_auto_20170807_1338'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='agreementamendment',
- name='types',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('Change IP name', 'Change in Legal Name of Implementing Partner'), ('Change authorized officer', 'Change Authorized Officer(s)'), ('Change banking info', 'Banking Information'), ('Change in clause', 'Change in clause')], max_length=50), size=None),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0049_auto_20170912_2004.py b/EquiTrack/partners/migrations/0049_auto_20170912_2004.py
deleted file mode 100644
index 75040fb4c..000000000
--- a/EquiTrack/partners/migrations/0049_auto_20170912_2004.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-12 20:04
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0048_auto_20170823_2012'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='filetype',
- name='name',
- field=models.CharField(choices=[('FACE', 'FACE'), ('Progress Report', 'Progress Report'), ('Partnership Review', 'Partnership Review'), ('Final Partnership Review', 'Final Partnership Review'), ('Correspondence', 'Correspondence'), ('Supply/Distribution Plan', 'Supply/Distribution Plan'), ('Other', 'Other')], max_length=64, unique=True),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0050_auto_20170914_1510.py b/EquiTrack/partners/migrations/0050_auto_20170914_1510.py
deleted file mode 100644
index 7bee99adf..000000000
--- a/EquiTrack/partners/migrations/0050_auto_20170914_1510.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-14 15:10
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0049_auto_20170912_2004'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='intervention',
- name='document_type',
- field=models.CharField(choices=[('PD', 'Programme Document'), ('SHPD', 'Simplified Humanitarian Programme Document'), ('SSFA', 'SSFA')], max_length=255, verbose_name='Document type'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0051_remove_governmentinterventionresult_activities.py b/EquiTrack/partners/migrations/0051_remove_governmentinterventionresult_activities.py
deleted file mode 100644
index c810c4b10..000000000
--- a/EquiTrack/partners/migrations/0051_remove_governmentinterventionresult_activities.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-28 07:13
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0050_auto_20170914_1510'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='activities',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0052_auto_20170929_1933.py b/EquiTrack/partners/migrations/0052_auto_20170929_1933.py
deleted file mode 100644
index e97a99a04..000000000
--- a/EquiTrack/partners/migrations/0052_auto_20170929_1933.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-29 19:33
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0051_remove_governmentinterventionresult_activities'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='distributionplan',
- name='intervention',
- ),
- migrations.RemoveField(
- model_name='distributionplan',
- name='item',
- ),
- migrations.RemoveField(
- model_name='distributionplan',
- name='partnership',
- ),
- migrations.RemoveField(
- model_name='distributionplan',
- name='site',
- ),
- migrations.RemoveField(
- model_name='supplyplan',
- name='intervention',
- ),
- migrations.RemoveField(
- model_name='supplyplan',
- name='item',
- ),
- migrations.RemoveField(
- model_name='supplyplan',
- name='partnership',
- ),
- migrations.DeleteModel(
- name='DistributionPlan',
- ),
- migrations.DeleteModel(
- name='SupplyPlan',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0053_auto_20171011_1623.py b/EquiTrack/partners/migrations/0053_auto_20171011_1623.py
deleted file mode 100644
index e5e703455..000000000
--- a/EquiTrack/partners/migrations/0053_auto_20171011_1623.py
+++ /dev/null
@@ -1,174 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-11 16:23
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0052_auto_20170929_1933'),
- ('trips', '0004_auto_20170928_2215'),
- ('tpm', '0002_auto_20170906_1417'),
- ('reports', '0013_auto_20170829_1727'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='amendmentlog',
- name='partnership',
- ),
- migrations.RemoveField(
- model_name='authorizedofficer',
- name='agreement',
- ),
- migrations.RemoveField(
- model_name='authorizedofficer',
- name='amendment',
- ),
- migrations.RemoveField(
- model_name='authorizedofficer',
- name='officer',
- ),
- migrations.RemoveField(
- model_name='bankdetails',
- name='partner_organization',
- ),
- migrations.RemoveField(
- model_name='gwpcalocation',
- name='location',
- ),
- migrations.RemoveField(
- model_name='gwpcalocation',
- name='pca',
- ),
- migrations.RemoveField(
- model_name='gwpcalocation',
- name='sector',
- ),
- migrations.RemoveField(
- model_name='indicatorduedates',
- name='intervention',
- ),
- migrations.RemoveField(
- model_name='partnershipbudget',
- name='amendment',
- ),
- migrations.RemoveField(
- model_name='partnershipbudget',
- name='partnership',
- ),
- migrations.RemoveField(
- model_name='pca',
- name='agreement',
- ),
- migrations.RemoveField(
- model_name='pca',
- name='partner',
- ),
- migrations.RemoveField(
- model_name='pca',
- name='partner_focal_point',
- ),
- migrations.RemoveField(
- model_name='pca',
- name='partner_manager',
- ),
- migrations.RemoveField(
- model_name='pca',
- name='unicef_manager',
- ),
- migrations.RemoveField(
- model_name='pca',
- name='unicef_managers',
- ),
- migrations.RemoveField(
- model_name='pcafile',
- name='pca',
- ),
- migrations.RemoveField(
- model_name='pcafile',
- name='type',
- ),
- migrations.RemoveField(
- model_name='pcagrant',
- name='amendment',
- ),
- migrations.RemoveField(
- model_name='pcagrant',
- name='grant',
- ),
- migrations.RemoveField(
- model_name='pcagrant',
- name='partnership',
- ),
- migrations.RemoveField(
- model_name='pcasector',
- name='amendment',
- ),
- migrations.RemoveField(
- model_name='pcasector',
- name='pca',
- ),
- migrations.RemoveField(
- model_name='pcasector',
- name='sector',
- ),
- migrations.RemoveField(
- model_name='pcasectorgoal',
- name='goal',
- ),
- migrations.RemoveField(
- model_name='pcasectorgoal',
- name='pca_sector',
- ),
- migrations.RemoveField(
- model_name='ramindicator',
- name='indicator',
- ),
- migrations.RemoveField(
- model_name='ramindicator',
- name='intervention',
- ),
- migrations.RemoveField(
- model_name='ramindicator',
- name='result',
- ),
- migrations.DeleteModel(
- name='AmendmentLog',
- ),
- migrations.DeleteModel(
- name='AuthorizedOfficer',
- ),
- migrations.DeleteModel(
- name='BankDetails',
- ),
- migrations.DeleteModel(
- name='GwPCALocation',
- ),
- migrations.DeleteModel(
- name='IndicatorDueDates',
- ),
- migrations.DeleteModel(
- name='PartnershipBudget',
- ),
- migrations.DeleteModel(
- name='PCA',
- ),
- migrations.DeleteModel(
- name='PCAFile',
- ),
- migrations.DeleteModel(
- name='PCAGrant',
- ),
- migrations.DeleteModel(
- name='PCASector',
- ),
- migrations.DeleteModel(
- name='PCASectorGoal',
- ),
- migrations.DeleteModel(
- name='RAMIndicator',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0054_auto_20171013_2147.py b/EquiTrack/partners/migrations/0054_auto_20171013_2147.py
deleted file mode 100644
index 6dbed3098..000000000
--- a/EquiTrack/partners/migrations/0054_auto_20171013_2147.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-13 21:47
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0053_auto_20171011_1623'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='agreementamendmentlog',
- name='agreement',
- ),
- migrations.RemoveField(
- model_name='indicatorreport',
- name='indicator',
- ),
- migrations.RemoveField(
- model_name='indicatorreport',
- name='location',
- ),
- migrations.RemoveField(
- model_name='indicatorreport',
- name='partner_staff_member',
- ),
- migrations.DeleteModel(
- name='AgreementAmendmentLog',
- ),
- migrations.DeleteModel(
- name='IndicatorReport',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0055_auto_20180129_1921.py b/EquiTrack/partners/migrations/0055_auto_20180129_1921.py
deleted file mode 100644
index eef1cfa2d..000000000
--- a/EquiTrack/partners/migrations/0055_auto_20180129_1921.py
+++ /dev/null
@@ -1,577 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-29 19:21
-from __future__ import unicode_literals
-
-from django.conf import settings
-import django.contrib.postgres.fields
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations, models
-import django.db.models.deletion
-import django.db.models.manager
-import django.utils.timezone
-import django_fsm
-import model_utils.fields
-import partners.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0014_auto_20171013_2147'),
- ('locations', '0006_auto_20171024_1011'),
- ('partners', '0054_auto_20171013_2147'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='InterventionReportingPeriod',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('start_date', models.DateField(verbose_name='Reporting Period Start Date')),
- ('end_date', models.DateField(verbose_name='Reporting Period End Date')),
- ('due_date', models.DateField(verbose_name='Report Due Date')),
- ],
- options={
- 'ordering': ['-due_date'],
- },
- ),
- migrations.RemoveField(
- model_name='governmentintervention',
- name='country_programme',
- ),
- migrations.RemoveField(
- model_name='governmentintervention',
- name='partner',
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='intervention',
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='result',
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='sections',
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='sectors',
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresult',
- name='unicef_managers',
- ),
- migrations.RemoveField(
- model_name='governmentinterventionresultactivity',
- name='intervention_result',
- ),
- migrations.AlterModelManagers(
- name='agreementamendment',
- managers=[
- ('view_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AddField(
- model_name='assessment',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='assessment',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='flat_locations',
- field=models.ManyToManyField(blank=True, related_name='intervention_flat_locations', to='locations.Location'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='in_amendment',
- field=models.BooleanField(default=False, verbose_name='Amendment Open'),
- ),
- migrations.AddField(
- model_name='intervention',
- name='sections',
- field=models.ManyToManyField(blank=True, related_name='interventions', to='reports.Sector', verbose_name='Sections'),
- ),
- migrations.AddField(
- model_name='interventionplannedvisits',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='interventionplannedvisits',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='interventionresultlink',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='interventionresultlink',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='interventionsectorlocationlink',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='interventionsectorlocationlink',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='partnerstaffmember',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='partnerstaffmember',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='agreement_type',
- field=models.CharField(choices=[('PCA', 'Programme Cooperation Agreement'), ('SSFA', 'Small Scale Funding Agreement'), ('MOU', 'Memorandum of Understanding')], max_length=10, verbose_name='Agreement Type'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='attached_agreement',
- field=models.FileField(blank=True, max_length=1024, upload_to=partners.models.get_agreement_path, verbose_name='Attached Agreement'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='authorized_officers',
- field=models.ManyToManyField(blank=True, related_name='agreement_authorizations', to='partners.PartnerStaffMember', verbose_name='Partner Authorized Officer'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='country_programme',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements', to='reports.CountryProgramme', verbose_name='Country Programme'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='end',
- field=models.DateField(blank=True, null=True, verbose_name='End Date'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='signed_by',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agreements_signed+', to=settings.AUTH_USER_MODEL, verbose_name='Signed By UNICEF'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='signed_by_partner_date',
- field=models.DateField(blank=True, null=True, verbose_name='Signed By Partner Date'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='signed_by_unicef_date',
- field=models.DateField(blank=True, null=True, verbose_name='Signed By UNICEF Date'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='start',
- field=models.DateField(blank=True, null=True, verbose_name='Start Date'),
- ),
- migrations.AlterField(
- model_name='agreement',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('signed', 'Signed'), ('ended', 'Ended'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32, verbose_name='Status'),
- ),
- migrations.AlterField(
- model_name='agreementamendment',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments', to='partners.Agreement', verbose_name='Agreement'),
- ),
- migrations.AlterField(
- model_name='agreementamendment',
- name='number',
- field=models.CharField(max_length=5, verbose_name='Number'),
- ),
- migrations.AlterField(
- model_name='agreementamendment',
- name='signed_amendment',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_agreement_amd_file_path, verbose_name='Signed Amendment'),
- ),
- migrations.AlterField(
- model_name='agreementamendment',
- name='signed_date',
- field=models.DateField(blank=True, null=True, verbose_name='Signed Date'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='approving_officer',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Approving Officer'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='completed_date',
- field=models.DateField(blank=True, null=True, verbose_name='Completed Date'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='names_of_other_agencies',
- field=models.CharField(blank=True, help_text='List the names of the other agencies they have worked with', max_length=255, null=True, verbose_name='Other Agencies'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assessments', to='partners.PartnerOrganization', verbose_name='Partner'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='planned_date',
- field=models.DateField(blank=True, null=True, verbose_name='Planned Date'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='rating',
- field=models.CharField(choices=[('high', 'High'), ('significant', 'Significant'), ('medium', 'Medium'), ('low', 'Low')], default='high', max_length=50, verbose_name='Rating'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='report',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_assesment_path, verbose_name='Report'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='requested_date',
- field=models.DateField(auto_now_add=True, verbose_name='Requested Date'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='requesting_officer',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='requested_assessments', to=settings.AUTH_USER_MODEL, verbose_name='Requesting Officer'),
- ),
- migrations.AlterField(
- model_name='assessment',
- name='type',
- field=models.CharField(choices=[('Micro Assessment', 'Micro Assessment'), ('Simplified Checklist', 'Simplified Checklist'), ('Scheduled Audit report', 'Scheduled Audit report'), ('Special Audit report', 'Special Audit report'), ('Other', 'Other')], max_length=50, verbose_name='Type'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='agreement',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interventions', to='partners.Agreement', verbose_name='Agreement'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='contingency_pd',
- field=models.BooleanField(default=False, verbose_name='Contingency PD'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='country_programme',
- field=models.ForeignKey(blank=True, help_text='Which Country Programme does this Intervention belong to?', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='interventions', to='reports.CountryProgramme', verbose_name='Country Programme'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='document_type',
- field=models.CharField(choices=[('PD', 'Programme Document'), ('SHPD', 'Simplified Humanitarian Programme Document'), ('SSFA', 'SSFA')], max_length=255, verbose_name='Document Type'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='end',
- field=models.DateField(blank=True, help_text='The date the Intervention will end', null=True, verbose_name='End Date'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='metadata',
- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='Metadata'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='offices',
- field=models.ManyToManyField(blank=True, related_name='_intervention_offices_+', to='users.Office', verbose_name='Office'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='partner_authorized_officer_signatory',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_interventions', to='partners.PartnerStaffMember', verbose_name='Signed by Partner'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='partner_focal_points',
- field=models.ManyToManyField(blank=True, related_name='_intervention_partner_focal_points_+', to='partners.PartnerStaffMember', verbose_name='CSO Authorized Officials'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='population_focus',
- field=models.CharField(blank=True, max_length=130, null=True, verbose_name='Population Focus'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='prc_review_document',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_prc_intervention_file_path, verbose_name='Review Document by PRC'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='review_date_prc',
- field=models.DateField(blank=True, help_text='The date the PRC reviewed the partnership', null=True, verbose_name='Review Date by PRC'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='signed_by_partner_date',
- field=models.DateField(blank=True, null=True, verbose_name='Signed by Partner Date'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='signed_by_unicef_date',
- field=models.DateField(blank=True, null=True, verbose_name='Signed by UNICEF Date'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='signed_pd_document',
- field=models.FileField(blank=True, max_length=1024, null=True, upload_to=partners.models.get_prc_intervention_file_path, verbose_name='Signed PD Document'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='start',
- field=models.DateField(blank=True, help_text='The date the Intervention will start', null=True, verbose_name='Start Date'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='status',
- field=django_fsm.FSMField(blank=True, choices=[('draft', 'Draft'), ('signed', 'Signed'), ('active', 'Active'), ('ended', 'Ended'), ('closed', 'Closed'), ('suspended', 'Suspended'), ('terminated', 'Terminated')], default='draft', max_length=32, verbose_name='Status'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='submission_date',
- field=models.DateField(blank=True, help_text='The date the partner submitted complete PD/SSFA documents to Unicef', null=True, verbose_name='Document Submission Date by CSO'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='title',
- field=models.CharField(max_length=256, verbose_name='Document Title'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='unicef_focal_points',
- field=models.ManyToManyField(blank=True, related_name='_intervention_unicef_focal_points_+', to=settings.AUTH_USER_MODEL, verbose_name='UNICEF Focal Points'),
- ),
- migrations.AlterField(
- model_name='intervention',
- name='unicef_signatory',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signed_interventions+', to=settings.AUTH_USER_MODEL, verbose_name='Signed by UNICEF'),
- ),
- migrations.AlterField(
- model_name='interventionamendment',
- name='amendment_number',
- field=models.IntegerField(default=0, verbose_name='Number'),
- ),
- migrations.AlterField(
- model_name='interventionamendment',
- name='intervention',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amendments', to='partners.Intervention', verbose_name='Reference Number'),
- ),
- migrations.AlterField(
- model_name='interventionamendment',
- name='other_description',
- field=models.CharField(blank=True, max_length=512, null=True, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='interventionamendment',
- name='signed_amendment',
- field=models.FileField(max_length=1024, upload_to=partners.models.get_intervention_amendment_file_path, verbose_name='Amendment Document'),
- ),
- migrations.AlterField(
- model_name='interventionamendment',
- name='signed_date',
- field=models.DateField(null=True, verbose_name='Signed Date'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='address',
- field=models.TextField(blank=True, null=True, verbose_name='Address'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='alternate_id',
- field=models.IntegerField(blank=True, null=True, verbose_name='Alternate ID'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='alternate_name',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Alternate Name'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='blocked',
- field=models.BooleanField(default=False, verbose_name='Blocked'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='city',
- field=models.CharField(blank=True, max_length=64, null=True, verbose_name='City'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='core_values_assessment',
- field=models.FileField(blank=True, help_text='Only required for CSO partners', max_length=1024, null=True, upload_to='partners/core_values/', verbose_name='Core Values Assessment'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='country',
- field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Country'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='description',
- field=models.CharField(blank=True, max_length=256, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='email',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Email Address'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='hact_values',
- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=partners.models.hact_default, null=True, verbose_name='HACT'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='hidden',
- field=models.BooleanField(default=False, verbose_name='Hidden'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='last_assessment_date',
- field=models.DateField(blank=True, null=True, verbose_name='Last Assessment Date'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='name',
- field=models.CharField(help_text='Please make sure this matches the name you enter in VISION', max_length=255, verbose_name='Name'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='partner_type',
- field=models.CharField(choices=[('Bilateral / Multilateral', 'Bilateral / Multilateral'), ('Civil Society Organization', 'Civil Society Organization'), ('Government', 'Government'), ('UN Agency', 'UN Agency')], max_length=50, verbose_name='Partner Type'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='phone_number',
- field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Phone Number'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='postal_code',
- field=models.CharField(blank=True, max_length=32, null=True, verbose_name='Postal Code'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='shared_partner',
- field=models.CharField(choices=[('No', 'No'), ('with UNDP', 'with UNDP'), ('with UNFPA', 'with UNFPA'), ('with UNDP & UNFPA', 'with UNDP & UNFPA')], default='No', help_text='Partner shared with UNDP or UNFPA?', max_length=50, verbose_name='Shared Partner (old)'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='shared_with',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, choices=[('DPKO', 'DPKO'), ('ECA', 'ECA'), ('ECLAC', 'ECLAC'), ('ESCWA', 'ESCWA'), ('FAO', 'FAO'), ('ILO', 'ILO'), ('IOM', 'IOM'), ('OHCHR', 'OHCHR'), ('UN', 'UN'), ('UN Women', 'UN Women'), ('UNAIDS', 'UNAIDS'), ('UNDP', 'UNDP'), ('UNESCO', 'UNESCO'), ('UNFPA', 'UNFPA'), ('UN - Habitat', 'UN - Habitat'), ('UNHCR', 'UNHCR'), ('UNODC', 'UNODC'), ('UNOPS', 'UNOPS'), ('UNRWA', 'UNRWA'), ('UNSC', 'UNSC'), ('UNU', 'UNU'), ('WB', 'WB'), ('WFP', 'WFP'), ('WHO', 'WHO')], max_length=20), blank=True, null=True, size=None, verbose_name='Shared Partner'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='short_name',
- field=models.CharField(blank=True, max_length=50, verbose_name='Short Name'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='street_address',
- field=models.CharField(blank=True, max_length=500, null=True, verbose_name='Street Address'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='total_ct_cp',
- field=models.DecimalField(blank=True, decimal_places=2, help_text='Total Cash Transferred for Country Programme', max_digits=12, null=True, verbose_name='Total Cash Transferred for Country Programme'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='total_ct_cy',
- field=models.DecimalField(blank=True, decimal_places=2, help_text='Total Cash Transferred per Current Year', max_digits=12, null=True, verbose_name='Total Cash Transferred per Current Year'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='type_of_assessment',
- field=models.CharField(max_length=50, null=True, verbose_name='Assessment Type'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='vendor_number',
- field=models.CharField(blank=True, max_length=30, null=True, unique=True, verbose_name='Vendor Number'),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='vision_synced',
- field=models.BooleanField(default=False, verbose_name='VISION Synced'),
- ),
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='active',
- field=models.BooleanField(default=True, verbose_name='Active'),
- ),
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='email',
- field=models.CharField(max_length=128, unique=True, verbose_name='Email Address'),
- ),
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='first_name',
- field=models.CharField(max_length=64, verbose_name='First Name'),
- ),
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='last_name',
- field=models.CharField(max_length=64, verbose_name='Last Name'),
- ),
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='partner',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='staff_members', to='partners.PartnerOrganization', verbose_name='Partner'),
- ),
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='phone',
- field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Phone Number'),
- ),
- migrations.AlterField(
- model_name='partnerstaffmember',
- name='title',
- field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Title'),
- ),
- migrations.DeleteModel(
- name='GovernmentIntervention',
- ),
- migrations.DeleteModel(
- name='GovernmentInterventionResult',
- ),
- migrations.DeleteModel(
- name='GovernmentInterventionResultActivity',
- ),
- migrations.AddField(
- model_name='interventionreportingperiod',
- name='intervention',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reporting_periods', to='partners.Intervention'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0056_read_only_api_permission_group.py b/EquiTrack/partners/migrations/0056_read_only_api_permission_group.py
deleted file mode 100644
index a95a5fc4b..000000000
--- a/EquiTrack/partners/migrations/0056_read_only_api_permission_group.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-20 15:23
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def remove_permission_group(apps, schema_editor):
- Group = apps.get_model('auth', 'Group')
- try:
- api_grp = Group.objects.get(name='Read-Only API')
- except Group.DoesNotExist:
- return
- api_grp.delete()
-
-def add_permission_group(apps, schema_editor):
- Group = apps.get_model('auth', 'Group')
- Group.objects.get_or_create(name='Read-Only API')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0055_auto_20180129_1921'),
- ]
-
- operations = [
- migrations.RunPython(
- add_permission_group, reverse_code=remove_permission_group),
- ]
diff --git a/EquiTrack/partners/migrations/0057_migrate_intervention_sectors_to_sections.py b/EquiTrack/partners/migrations/0057_migrate_intervention_sectors_to_sections.py
deleted file mode 100644
index c6cdca169..000000000
--- a/EquiTrack/partners/migrations/0057_migrate_intervention_sectors_to_sections.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-15 17:35
-from __future__ import unicode_literals
-
-from django.db import migrations, models, connection, transaction
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0008_workspacecounter'),
- ('partners', '0056_read_only_api_permission_group'),
- ]
-
- def reverse(apps, schema_editor):
- pass
-
- @transaction.atomic
- def migrate_sector_location_links_to_intervention_section(apps, schema_editor):
- InterventionSectorLocationLink = apps.get_model('partners', 'InterventionSectorLocationLink')
-
- for interventionsector in InterventionSectorLocationLink.objects.all():
- intervention = interventionsector.intervention
- intervention.sections.add(interventionsector.sector)
-
- operations = [
- migrations.RunPython(migrate_sector_location_links_to_intervention_section, reverse_code=reverse)
- ]
-
diff --git a/EquiTrack/partners/migrations/0058_intervention_locations.py b/EquiTrack/partners/migrations/0058_intervention_locations.py
deleted file mode 100644
index 1634b2ee9..000000000
--- a/EquiTrack/partners/migrations/0058_intervention_locations.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-12 15:04
-from __future__ import unicode_literals
-
-from django.db import migrations, models, transaction
-
-
-@transaction.atomic
-def migrate_sector_location_links_to_intervention_locations(apps, schema_editor):
- InterventionSectorLocationLink = apps.get_model('partners', 'InterventionSectorLocationLink')
-
- for interventionsector in InterventionSectorLocationLink.objects.all():
- intervention = interventionsector.intervention
- intervention.flat_locations.add(*list(interventionsector.locations.all()))
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0006_auto_20171024_1011'),
- ('partners', '0057_migrate_intervention_sectors_to_sections'),
- ]
-
- operations = [
- migrations.RunPython(migrate_sector_location_links_to_intervention_locations, reverse_code=migrations.RunPython.noop)
- ]
diff --git a/EquiTrack/partners/migrations/0059_auto_20180206_1548.py b/EquiTrack/partners/migrations/0059_auto_20180206_1548.py
deleted file mode 100644
index 9f99887ec..000000000
--- a/EquiTrack/partners/migrations/0059_auto_20180206_1548.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-02-06 15:48
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0058_intervention_locations'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='partnerorganization',
- name='net_ct_cy',
- field=models.DecimalField(blank=True, decimal_places=2, help_text='Net Cash Transferred per Current Year', max_digits=12, null=True),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='reported_cy',
- field=models.DecimalField(blank=True, decimal_places=2, help_text='Liquidations 1 Oct - 30 Sep', max_digits=12, null=True),
- ),
- migrations.AddField(
- model_name='partnerorganization',
- name='total_ct_ytd',
- field=models.DecimalField(blank=True, decimal_places=2, help_text='Cash Transfers Jan - Dec', max_digits=12, null=True),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0060_interventionbudget_total_local.py b/EquiTrack/partners/migrations/0060_interventionbudget_total_local.py
deleted file mode 100644
index c7a4349e5..000000000
--- a/EquiTrack/partners/migrations/0060_interventionbudget_total_local.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-02-21 15:25
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0059_auto_20180206_1548'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='interventionbudget',
- name='total_local',
- field=models.DecimalField(decimal_places=2, default=0, max_digits=20),
- preserve_default=False,
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0061_auto_20180221_1654.py b/EquiTrack/partners/migrations/0061_auto_20180221_1654.py
deleted file mode 100644
index a538d50aa..000000000
--- a/EquiTrack/partners/migrations/0061_auto_20180221_1654.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-02-21 16:54
-from __future__ import unicode_literals
-
-import EquiTrack.fields
-from django.db import migrations
-
-
-def reverse():
- raise Exception("Can't migrate the budgets backwards")
-
-
-def migrate_currencies(apps, schema_editor):
- InterventionBudget = apps.get_model('partners', 'InterventionBudget')
-
- for budget in InterventionBudget.objects.all():
- budget.currency_temp = budget.currency.code
- budget.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0060_interventionbudget_total_local'),
- ]
-
- operations = [
-
- migrations.AddField(
- model_name='interventionbudget',
- name='currency_temp',
- field=EquiTrack.fields.CurrencyField(blank=True, choices=[('GIP', 'GIP'), ('KPW', 'KPW'), ('XEU', 'XEU'), ('BHD', 'BHD'), ('BIF', 'BIF'), ('BMD', 'BMD'), ('BSD', 'BSD'), ('YER1', 'YER1'), ('AFN', 'AFN'), ('ALL', 'ALL'), ('AMD', 'AMD'), ('AUD', 'AUD'), ('AZN', 'AZN'), ('BAM', 'BAM'), ('BBD', 'BBD'), ('BDT', 'BDT'), ('BZD', 'BZD'), ('CUP1', 'CUP1'), ('BTN', 'BTN'), ('ZWL', 'ZWL'), ('AWG', 'AWG'), ('CUC', 'CUC'), ('VEF01', 'VEF01'), ('BND', 'BND'), ('BRL', 'BRL'), ('ARS', 'ARS'), ('ETB', 'ETB'), ('EUR', 'EUR'), ('FJD', 'FJD'), ('GBP', 'GBP'), ('GEL', 'GEL'), ('GHS', 'GHS'), ('GNF', 'GNF'), ('GTQ', 'GTQ'), ('GYD', 'GYD'), ('HNL', 'HNL'), ('CAD', 'CAD'), ('CDF', 'CDF'), ('CLP', 'CLP'), ('CNY', 'CNY'), ('COP', 'COP'), ('CRC', 'CRC'), ('CUP', 'CUP'), ('CVE', 'CVE'), ('DJF', 'DJF'), ('DKK', 'DKK'), ('DOP', 'DOP'), ('DZD', 'DZD'), ('EGP', 'EGP'), ('HRK', 'HRK'), ('LVL', 'LVL'), ('LYD', 'LYD'), ('MAD', 'MAD'), ('MGA', 'MGA'), ('MKD', 'MKD'), ('KWD', 'KWD'), ('KYD', 'KYD'), ('LBP', 'LBP'), ('LKR', 'LKR'), ('MDL', 'MDL'), ('KZT', 'KZT'), ('LRD', 'LRD'), ('BOB', 'BOB'), ('HKD', 'HKD'), ('CHF', 'CHF'), ('KES', 'KES'), ('MYR', 'MYR'), ('NGN', 'NGN'), ('KMF', 'KMF'), ('SCR', 'SCR'), ('SEK', 'SEK'), ('TTD', 'TTD'), ('PKR', 'PKR'), ('NIO', 'NIO'), ('RWF', 'RWF'), ('BWP', 'BWP'), ('JMD', 'JMD'), ('TJS', 'TJS'), ('UYU', 'UYU'), ('RON', 'RON'), ('PYG', 'PYG'), ('SYP', 'SYP'), ('LAK', 'LAK'), ('ERN', 'ERN'), ('SLL', 'SLL'), ('PLN', 'PLN'), ('JOD', 'JOD'), ('ILS', 'ILS'), ('AED', 'AED'), ('NPR', 'NPR'), ('NZD', 'NZD'), ('SGD', 'SGD'), ('JPY', 'JPY'), ('PAB', 'PAB'), ('ZMW', 'ZMW'), ('CZK', 'CZK'), ('SOS', 'SOS'), ('LTL', 'LTL'), ('KGS', 'KGS'), ('SHP', 'SHP'), ('BGN', 'BGN'), ('TOP', 'TOP'), ('MVR', 'MVR'), ('VEF02', 'VEF02'), ('TMT', 'TMT'), ('GMD', 'GMD'), ('MZN', 'MZN'), ('RSD', 'RSD'), ('MWK', 'MWK'), ('PGK', 'PGK'), ('MXN', 'MXN'), ('XAF', 'XAF'), ('VND', 'VND'), ('INR', 'INR'), ('NOK', 'NOK'), ('XPF', 'XPF'), ('SSP', 'SSP'), ('IQD', 'IQD'), ('SRD', 'SRD'), ('SAR', 'SAR'), ('XCD', 'XCD'), ('IRR', 'IRR'), ('KPW01', 'KPW01'), ('HTG', 'HTG'), ('IDR', 'IDR'), ('XOF', 'XOF'), ('ISK', 'ISK'), ('ANG', 'ANG'), ('NAD', 'NAD'), ('MMK', 'MMK'), ('STD', 'STD'), ('VUV', 'VUV'), ('LSL', 'LSL'), ('SVC', 'SVC'), ('KHR', 'KHR'), ('SZL', 'SZL'), ('RUB', 'RUB'), ('UAH', 'UAH'), ('UGX', 'UGX'), ('THB', 'THB'), ('AOA', 'AOA'), ('YER', 'YER'), ('USD', 'USD'), ('UZS', 'UZS'), ('OMR', 'OMR'), ('SBD', 'SBD'), ('TZS', 'TZS'), ('SDG', 'SDG'), ('WST', 'WST'), ('QAR', 'QAR'), ('MOP', 'MOP'), ('MRO', 'MRO'), ('VEF', 'VEF'), ('TRY', 'TRY'), ('ZAR', 'ZAR'), ('HUF', 'HUF'), ('MUR', 'MUR'), ('PHP', 'PHP'), ('BYN', 'BYN'), ('KRW', 'KRW'), ('TND', 'TND'), ('MNT', 'MNT'), ('PEN', 'PEN')], max_length=4, null=True),
- ),
- migrations.RunPython(migrate_currencies, reverse_code=reverse),
- migrations.RemoveField(
- model_name='interventionbudget',
- name='currency'
- ),
- migrations.RenameField(
- model_name='interventionbudget',
- old_name="currency_temp",
- new_name="currency"
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0062_auto_20180226_2112.py b/EquiTrack/partners/migrations/0062_auto_20180226_2112.py
deleted file mode 100644
index 2709f68a3..000000000
--- a/EquiTrack/partners/migrations/0062_auto_20180226_2112.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.10 on 2018-02-26 21:12
-from __future__ import unicode_literals
-
-import EquiTrack.fields
-from django.db import migrations, models
-import django.db.models.deletion
-import django.utils.timezone
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0061_auto_20180221_1654'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='PlannedEngagement',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('spot_check_mr', EquiTrack.fields.QuarterField(blank=True, choices=[('q1', 'Q1'), ('q2', 'Q2'), ('q3', 'Q3'), ('q4', 'Q4')], max_length=2, null=True)),
- ('spot_check_follow_up_q1', models.IntegerField(default=0, verbose_name='Spot Check Q1')),
- ('spot_check_follow_up_q2', models.IntegerField(default=0, verbose_name='Spot Check Q2')),
- ('spot_check_follow_up_q3', models.IntegerField(default=0, verbose_name='Spot Check Q3')),
- ('spot_check_follow_up_q4', models.IntegerField(default=0, verbose_name='Spot Check Q4')),
- ('scheduled_audit', models.BooleanField(default=False, verbose_name='Scheduled Audit')),
- ('special_audit', models.BooleanField(default=False, verbose_name='Special Audit')),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.AddField(
- model_name='interventionplannedvisits',
- name='quarter',
- field=EquiTrack.fields.QuarterField(blank=True, choices=[('q1', 'Q1'), ('q2', 'Q2'), ('q3', 'Q3'), ('q4', 'Q4')], max_length=2, null=True),
- ),
- migrations.AlterField(
- model_name='partnerorganization',
- name='rating',
- field=models.CharField(blank=True, choices=[('High', 'High'), ('Significant', 'Significant'), ('Moderate', 'Medium'), ('Low', 'Low'), ('Non-Assessed', 'Non Required')], max_length=50, null=True, verbose_name='Risk Rating'),
- ),
- migrations.RemoveField(
- model_name='interventionplannedvisits',
- name='audit',
- ),
- migrations.RemoveField(
- model_name='interventionplannedvisits',
- name='spot_checks',
- ),
- migrations.AlterUniqueTogether(
- name='interventionplannedvisits',
- unique_together=set([('intervention', 'year', 'quarter')]),
- ),
- migrations.AddField(
- model_name='plannedengagement',
- name='partner',
- field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='planned_engagement', to='partners.PartnerOrganization', verbose_name='Partner'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0063_auto_20180226_2112.py b/EquiTrack/partners/migrations/0063_auto_20180226_2112.py
deleted file mode 100644
index 55a5fca89..000000000
--- a/EquiTrack/partners/migrations/0063_auto_20180226_2112.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.10 on 2018-02-26 21:12
-from __future__ import unicode_literals
-
-from django.db import migrations, transaction
-
-
-@transaction.atomic
-def create_planned_engagements(apps, schema_editor):
- PartnerOrganization = apps.get_model('partners', 'PartnerOrganization')
- PlannedEngagement = apps.get_model('partners', 'PlannedEngagement')
- for partner in PartnerOrganization.objects.all():
- PlannedEngagement.objects.get_or_create(partner=partner)
-
-
-@transaction.atomic
-def migrate_shared_partner(apps, schema_editor):
- PartnerOrganization = apps.get_model('partners', 'PartnerOrganization')
-
- for p in PartnerOrganization.objects.filter(shared_partner='with UNDP').exclude(shared_with__contains=['UNDP',]):
- if not p.shared_with:
- p.shared_with = []
- p.shared_with.append('UNDP')
- p.save()
- for p in PartnerOrganization.objects.filter(shared_partner='with UNFPA').exclude(shared_with__contains=['UNFPA',]):
- if not p.shared_with:
- p.shared_with = []
- p.shared_with.append('UNFPA')
- p.save()
- for p in PartnerOrganization.objects.filter(shared_partner='with UNDP & UNFPA').exclude(shared_with__contains=['UNFPA',]):
- if not p.shared_with:
- p.shared_with = []
- p.shared_with.append('UNFPA')
- p.save()
- for p in PartnerOrganization.objects.filter(shared_partner='with UNDP & UNFPA').exclude(shared_with__contains=['UNDP',]):
- if not p.shared_with:
- p.shared_with = []
- p.shared_with.append('UNDP')
- p.save()
-
-
-@transaction.atomic
-def migrate_planned_visits(apps, schema_editor):
- InterventionPlannedVisits = apps.get_model('partners', 'InterventionPlannedVisits')
- InterventionPlannedVisits.objects.all().update(quarter='q4')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0062_auto_20180226_2112'),
- ]
-
- operations = [
- migrations.RunPython(create_planned_engagements, reverse_code=migrations.RunPython.noop),
- migrations.RunPython(migrate_shared_partner, reverse_code=migrations.RunPython.noop),
- migrations.RunPython(migrate_planned_visits, reverse_code=migrations.RunPython.noop)
- ]
diff --git a/EquiTrack/partners/migrations/0064_remove_partnerorganization_shared_partner.py b/EquiTrack/partners/migrations/0064_remove_partnerorganization_shared_partner.py
deleted file mode 100644
index 145698e70..000000000
--- a/EquiTrack/partners/migrations/0064_remove_partnerorganization_shared_partner.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.10 on 2018-02-26 21:13
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0063_auto_20180226_2112'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='partnerorganization',
- name='shared_partner',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0065_auto_20180228_1715.py b/EquiTrack/partners/migrations/0065_auto_20180228_1715.py
deleted file mode 100644
index 47133db1c..000000000
--- a/EquiTrack/partners/migrations/0065_auto_20180228_1715.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-02-28 17:15
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0064_remove_partnerorganization_shared_partner'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='interventionplannedvisits',
- old_name='programmatic',
- new_name='programmatic_q4',
- ),
- migrations.AddField(
- model_name='interventionplannedvisits',
- name='programmatic_q1',
- field=models.IntegerField(default=0),
- ),
- migrations.AddField(
- model_name='interventionplannedvisits',
- name='programmatic_q2',
- field=models.IntegerField(default=0),
- ),
- migrations.AddField(
- model_name='interventionplannedvisits',
- name='programmatic_q3',
- field=models.IntegerField(default=0),
- ),
- migrations.AlterUniqueTogether(
- name='interventionplannedvisits',
- unique_together=set([('intervention', 'year')]),
- ),
- migrations.RemoveField(
- model_name='interventionplannedvisits',
- name='quarter',
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0066_partnerorganization_basis_for_risk_rating.py b/EquiTrack/partners/migrations/0066_partnerorganization_basis_for_risk_rating.py
deleted file mode 100644
index 2c7f47ace..000000000
--- a/EquiTrack/partners/migrations/0066_partnerorganization_basis_for_risk_rating.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-01 21:16
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0065_auto_20180228_1715'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='partnerorganization',
- name='basis_for_risk_rating',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Basis for Risk Rating'),
- ),
- ]
diff --git a/EquiTrack/partners/migrations/0067_auto_20180309_1210.py b/EquiTrack/partners/migrations/0067_auto_20180309_1210.py
deleted file mode 100644
index 8900e0f35..000000000
--- a/EquiTrack/partners/migrations/0067_auto_20180309_1210.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-09 12:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0066_partnerorganization_basis_for_risk_rating'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='interventionplannedvisits',
- options={'verbose_name_plural': 'Intervention Planned Visits'},
- ),
- ]
diff --git a/EquiTrack/partners/models.py b/EquiTrack/partners/models.py
index 613ffdb6f..70e2726aa 100644
--- a/EquiTrack/partners/models.py
+++ b/EquiTrack/partners/models.py
@@ -145,7 +145,7 @@ class WorkspaceFileType(models.Model):
Represents a file type
"""
- name = models.CharField(max_length=64, unique=True)
+ name = models.CharField(max_length=64, unique=True, verbose_name=_('Name'))
def __str__(self):
return self.name
@@ -439,17 +439,20 @@ class PartnerOrganization(AdminURLMixin, TimeStampedModel):
net_ct_cy = models.DecimalField(
decimal_places=2, max_digits=12, blank=True, null=True,
- help_text='Net Cash Transferred per Current Year'
+ help_text='Net Cash Transferred per Current Year',
+ verbose_name=_('Net Cash Transferred')
)
reported_cy = models.DecimalField(
decimal_places=2, max_digits=12, blank=True, null=True,
- help_text='Liquidations 1 Oct - 30 Sep'
+ help_text='Liquidations 1 Oct - 30 Sep',
+ verbose_name=_('Liquidation')
)
total_ct_ytd = models.DecimalField(
decimal_places=2, max_digits=12, blank=True, null=True,
- help_text='Cash Transfers Jan - Dec'
+ help_text='Cash Transfers Jan - Dec',
+ verbose_name=_('Cash Transfer Jan - Dec')
)
hact_values = JSONField(blank=True, null=True, default=hact_default, verbose_name='HACT')
@@ -791,7 +794,7 @@ def save(self, **kwargs):
class PlannedEngagement(TimeStampedModel):
""" class to handle partner's engagement for current year """
partner = models.OneToOneField(PartnerOrganization, verbose_name=_("Partner"), related_name='planned_engagement')
- spot_check_mr = QuarterField()
+ spot_check_mr = QuarterField(verbose_name=_('Spot Check MR'))
spot_check_follow_up_q1 = models.IntegerField(verbose_name=_("Spot Check Q1"), default=0)
spot_check_follow_up_q2 = models.IntegerField(verbose_name=_("Spot Check Q2"), default=0)
spot_check_follow_up_q3 = models.IntegerField(verbose_name=_("Spot Check Q3"), default=0)
@@ -999,7 +1002,7 @@ class Agreement(TimeStampedModel):
SIGNED: [activity_to_active_side_effects],
}
- partner = models.ForeignKey(PartnerOrganization, related_name="agreements")
+ partner = models.ForeignKey(PartnerOrganization, related_name="agreements", verbose_name=_('Partner'))
country_programme = models.ForeignKey(
'reports.CountryProgramme',
verbose_name=_("Country Programme"),
@@ -1274,6 +1277,7 @@ class AgreementAmendment(TimeStampedModel):
)
types = ArrayField(models.CharField(
max_length=50,
+ verbose_name=_('Types'),
choices=AMENDMENT_TYPES))
signed_date = models.DateField(
verbose_name=_("Signed Date"),
@@ -1587,7 +1591,8 @@ class Intervention(TimeStampedModel):
related_name='office_interventions+',
)
# TODO: remove this after PRP flag is on for all countries
- flat_locations = models.ManyToManyField(Location, related_name="intervention_flat_locations", blank=True)
+ flat_locations = models.ManyToManyField(Location, related_name="intervention_flat_locations", blank=True,
+ verbose_name=_('Locations'))
population_focus = models.CharField(
verbose_name=_("Population Focus"),
@@ -1936,6 +1941,7 @@ class InterventionAmendment(TimeStampedModel):
types = ArrayField(models.CharField(
max_length=50,
+ verbose_name=_('Types'),
choices=AMENDMENT_TYPES))
other_description = models.CharField(
@@ -2000,12 +2006,12 @@ class InterventionPlannedVisits(TimeStampedModel):
Represents planned visits for the intervention
"""
- intervention = models.ForeignKey(Intervention, related_name='planned_visits')
- year = models.IntegerField(default=get_current_year)
- programmatic_q1 = models.IntegerField(default=0)
- programmatic_q2 = models.IntegerField(default=0)
- programmatic_q3 = models.IntegerField(default=0)
- programmatic_q4 = models.IntegerField(default=0)
+ intervention = models.ForeignKey(Intervention, related_name='planned_visits', verbose_name=_('Intervention'))
+ year = models.IntegerField(default=get_current_year, verbose_name=_('Year'))
+ programmatic_q1 = models.IntegerField(default=0, verbose_name=_('Programmatic Q1'))
+ programmatic_q2 = models.IntegerField(default=0, verbose_name=_('Programmatic Q2'))
+ programmatic_q3 = models.IntegerField(default=0, verbose_name=_('Programmatic Q3'))
+ programmatic_q4 = models.IntegerField(default=0, verbose_name=_('Programmatic Q4'))
tracker = FieldTracker()
@@ -2019,9 +2025,9 @@ def __str__(self):
@python_2_unicode_compatible
class InterventionResultLink(TimeStampedModel):
- intervention = models.ForeignKey(Intervention, related_name='result_links')
- cp_output = models.ForeignKey(Result, related_name='intervention_links')
- ram_indicators = models.ManyToManyField(Indicator, blank=True)
+ intervention = models.ForeignKey(Intervention, related_name='result_links', verbose_name=_('Intervention'))
+ cp_output = models.ForeignKey(Result, related_name='intervention_links', verbose_name=_('CP Output'))
+ ram_indicators = models.ManyToManyField(Indicator, blank=True, verbose_name=_('RAM Indicators'))
tracker = FieldTracker()
@@ -2036,26 +2042,30 @@ class InterventionBudget(TimeStampedModel):
"""
Represents a budget for the intervention
"""
- intervention = models.OneToOneField(Intervention, related_name='planned_budget', null=True, blank=True)
+ intervention = models.OneToOneField(Intervention, related_name='planned_budget', null=True, blank=True,
+ verbose_name=_('Intervention'))
- partner_contribution = models.DecimalField(max_digits=20, decimal_places=2, default=0)
- unicef_cash = models.DecimalField(max_digits=20, decimal_places=2, default=0)
+ partner_contribution = models.DecimalField(max_digits=20, decimal_places=2, default=0,
+ verbose_name=_('Partner Contribution'))
+ unicef_cash = models.DecimalField(max_digits=20, decimal_places=2, default=0, verbose_name=_('Unicef Cash'))
in_kind_amount = models.DecimalField(
max_digits=20,
decimal_places=2,
default=0,
verbose_name=_('UNICEF Supplies')
)
- total = models.DecimalField(max_digits=20, decimal_places=2)
+ total = models.DecimalField(max_digits=20, decimal_places=2, verbose_name=_('Total'))
- partner_contribution_local = models.DecimalField(max_digits=20, decimal_places=2, default=0)
- unicef_cash_local = models.DecimalField(max_digits=20, decimal_places=2, default=0)
+ partner_contribution_local = models.DecimalField(max_digits=20, decimal_places=2, default=0,
+ verbose_name=_('Partner Contribution Local'))
+ unicef_cash_local = models.DecimalField(max_digits=20, decimal_places=2, default=0,
+ verbose_name=_('Unicef Cash Local'))
in_kind_amount_local = models.DecimalField(
max_digits=20, decimal_places=2, default=0,
verbose_name=_('UNICEF Supplies Local')
)
- currency = CurrencyField()
- total_local = models.DecimalField(max_digits=20, decimal_places=2)
+ currency = CurrencyField(verbose_name=_('Currency'))
+ total_local = models.DecimalField(max_digits=20, decimal_places=2, verbose_name=_('Total Local'))
tracker = FieldTracker()
@@ -2105,7 +2115,7 @@ class FileType(models.Model):
(SUPPLY_PLAN, SUPPLY_PLAN),
(OTHER, OTHER),
)
- name = models.CharField(max_length=64, choices=NAME_CHOICES, unique=True)
+ name = models.CharField(max_length=64, choices=NAME_CHOICES, unique=True, verbose_name=_('Name'))
tracker = FieldTracker()
@@ -2121,12 +2131,13 @@ class InterventionAttachment(TimeStampedModel):
Relates to :model:`partners.Intervention`
Relates to :model:`partners.WorkspaceFileType`
"""
- intervention = models.ForeignKey(Intervention, related_name='attachments')
- type = models.ForeignKey(FileType, related_name='+')
+ intervention = models.ForeignKey(Intervention, related_name='attachments', verbose_name=_('Intervention'))
+ type = models.ForeignKey(FileType, related_name='+', verbose_name=_('Type'))
attachment = models.FileField(
max_length=1024,
- upload_to=get_intervention_attachments_file_path
+ upload_to=get_intervention_attachments_file_path,
+ verbose_name=_('Attachment')
)
attachment_file = CodedGenericRelation(
Attachment,
@@ -2154,7 +2165,7 @@ class InterventionReportingPeriod(TimeStampedModel):
There can be multiple sets of these dates for each intervention, but
within each set, start < end < due.
"""
- intervention = models.ForeignKey(Intervention, related_name='reporting_periods')
+ intervention = models.ForeignKey(Intervention, related_name='reporting_periods', verbose_name=_('Intervention'))
start_date = models.DateField(verbose_name='Reporting Period Start Date')
end_date = models.DateField(verbose_name='Reporting Period End Date')
due_date = models.DateField(verbose_name='Report Due Date')
@@ -2170,9 +2181,10 @@ def __str__(self):
# TODO intervention sector locations cleanup
class InterventionSectorLocationLink(TimeStampedModel):
- intervention = models.ForeignKey(Intervention, related_name='sector_locations')
- sector = models.ForeignKey(Sector, related_name='intervention_locations')
- locations = models.ManyToManyField(Location, related_name='intervention_sector_locations', blank=True)
+ intervention = models.ForeignKey(Intervention, related_name='sector_locations', verbose_name=_('Intervention'))
+ sector = models.ForeignKey(Sector, related_name='intervention_locations', verbose_name=_('Sector'))
+ locations = models.ManyToManyField(Location, related_name='intervention_sector_locations', blank=True,
+ verbose_name=_('Locations'))
tracker = FieldTracker()
@@ -2191,20 +2203,20 @@ class FundingCommitment(TimeFramedModel):
Relates to :model:`funds.Grant`
"""
- grant = models.ForeignKey(Grant, null=True, blank=True)
- fr_number = models.CharField(max_length=50)
- wbs = models.CharField(max_length=50)
- fc_type = models.CharField(max_length=50)
+ grant = models.ForeignKey(Grant, null=True, blank=True, verbose_name=_('Grant'))
+ fr_number = models.CharField(max_length=50, verbose_name=_('FR Number'))
+ wbs = models.CharField(max_length=50, verbose_name=_('WBS'))
+ fc_type = models.CharField(max_length=50, verbose_name=_('Type'))
fc_ref = models.CharField(
- max_length=50, blank=True, null=True, unique=True)
+ max_length=50, blank=True, null=True, unique=True, verbose_name=_('Reference'))
fr_item_amount_usd = models.DecimalField(
- decimal_places=2, max_digits=12, blank=True, null=True)
+ decimal_places=2, max_digits=12, blank=True, null=True, verbose_name=_('Item Amount (USD)'))
agreement_amount = models.DecimalField(
- decimal_places=2, max_digits=12, blank=True, null=True)
+ decimal_places=2, max_digits=12, blank=True, null=True, verbose_name=_('Agreement Amount'))
commitment_amount = models.DecimalField(
- decimal_places=2, max_digits=12, blank=True, null=True)
+ decimal_places=2, max_digits=12, blank=True, null=True, verbose_name=_('Commitment Amount'))
expenditure_amount = models.DecimalField(
- decimal_places=2, max_digits=12, blank=True, null=True)
+ decimal_places=2, max_digits=12, blank=True, null=True, verbose_name=_('Expenditure Amount'))
tracker = FieldTracker()
objects = FCManager()
@@ -2215,14 +2227,19 @@ class DirectCashTransfer(models.Model):
Represents a direct cash transfer
"""
- fc_ref = models.CharField(max_length=50)
- amount_usd = models.DecimalField(decimal_places=2, max_digits=10)
- liquidation_usd = models.DecimalField(decimal_places=2, max_digits=10)
- outstanding_balance_usd = models.DecimalField(decimal_places=2, max_digits=10)
- amount_less_than_3_Months_usd = models.DecimalField(decimal_places=2, max_digits=10)
- amount_3_to_6_months_usd = models.DecimalField(decimal_places=2, max_digits=10)
- amount_6_to_9_months_usd = models.DecimalField(decimal_places=2, max_digits=10)
- amount_more_than_9_Months_usd = models.DecimalField(decimal_places=2, max_digits=10)
+ fc_ref = models.CharField(max_length=50, verbose_name=_('Fund Commitment Reference'))
+ amount_usd = models.DecimalField(decimal_places=2, max_digits=10, verbose_name=_('Amount (USD)'))
+ liquidation_usd = models.DecimalField(decimal_places=2, max_digits=10, verbose_name=_('Liquidation (USD)'))
+ outstanding_balance_usd = models.DecimalField(decimal_places=2, max_digits=10,
+ verbose_name=_('Outstanding Balance (USD)'))
+ amount_less_than_3_Months_usd = models.DecimalField(decimal_places=2, max_digits=10,
+ verbose_name=_('Amount mess than 3 months (USD)'))
+ amount_3_to_6_months_usd = models.DecimalField(decimal_places=2, max_digits=10,
+ verbose_name=_('Amount between 3 and 6 months (USD)'))
+ amount_6_to_9_months_usd = models.DecimalField(decimal_places=2, max_digits=10,
+ verbose_name=_('Amount between 6 and 9 months (USD)'))
+ amount_more_than_9_Months_usd = models.DecimalField(decimal_places=2, max_digits=10,
+ verbose_name=_('Amount more than 9 months (USD)'))
tracker = FieldTracker()
diff --git a/EquiTrack/partners/tests/factories.py b/EquiTrack/partners/tests/factories.py
index fe3f1cbac..6645b37f4 100644
--- a/EquiTrack/partners/tests/factories.py
+++ b/EquiTrack/partners/tests/factories.py
@@ -132,7 +132,7 @@ class Meta:
intervention = factory.SubFactory(InterventionFactory)
attachment = factory.django.FileField(filename='test_file.pdf')
- type = factory.Iterator(models.FileType.objects.all())
+ type = factory.SubFactory(FileTypeFactory)
class InterventionBudgetFactory(factory.django.DjangoModelFactory):
diff --git a/EquiTrack/partners/tests/test_api_prp.py b/EquiTrack/partners/tests/test_api_prp.py
index 4d6a8f60b..4e362a598 100644
--- a/EquiTrack/partners/tests/test_api_prp.py
+++ b/EquiTrack/partners/tests/test_api_prp.py
@@ -2,7 +2,6 @@
import os
import datetime
-from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse, resolve
from rest_framework import status
@@ -17,7 +16,7 @@
from partners.tests.test_utils import setup_intervention_test_data
from reports.models import LowerResult, AppliedIndicator, IndicatorBlueprint
from reports.tests.factories import ResultFactory
-from users.tests.factories import UserFactory
+from users.tests.factories import UserFactory, GroupFactory
class TestInterventionsAPI(WorkspaceRequiredAPITestMixIn, BaseTenantTestCase):
@@ -131,6 +130,11 @@ def test_prp_api_performance(self):
class TestInterventionsAPIListPermissions(BaseTenantTestCase):
'''Exercise permissions on the PRPIntervention list view'''
+
+ @classmethod
+ def setUpTestData(cls):
+ cls.readonly_group = GroupFactory(name=READ_ONLY_API_GROUP_NAME)
+
def setUp(self):
self.url = reverse('prp_api_v1:prp-intervention-list')
self.query_param_data = {'workspace': self.tenant.business_area_code}
@@ -151,7 +155,7 @@ def test_no_permission_user_forbidden(self):
def test_group_member_has_access(self):
'''Ensure a non-staff user in the correct group has access'''
user = UserFactory()
- user.groups.add(Group.objects.get(name=READ_ONLY_API_GROUP_NAME))
+ user.groups.add(self.readonly_group)
response = self.forced_auth_req('get', self.url, user=user, data=self.query_param_data)
self.assertEquals(response.status_code, status.HTTP_200_OK)
diff --git a/EquiTrack/partners/tests/test_validation_interventions.py b/EquiTrack/partners/tests/test_validation_interventions.py
index e1033b22f..2ca29e176 100644
--- a/EquiTrack/partners/tests/test_validation_interventions.py
+++ b/EquiTrack/partners/tests/test_validation_interventions.py
@@ -27,7 +27,7 @@
InterventionAttachmentFactory,
InterventionFactory,
PartnerStaffFactory,
-)
+ FileTypeFactory)
from partners.validation.interventions import (
InterventionValid,
partnership_manager_only,
@@ -69,6 +69,8 @@ def setUpTestData(cls):
end=datetime.date(2001, 1, 1),
)
+ cls.file_parnership_file_type = FileTypeFactory(name=FileType.FINAL_PARTNERSHIP_REVIEW)
+
def setUp(self):
super(TestTransitionToClosed, self).setUp()
self.expected = {
@@ -200,9 +202,7 @@ def test_attachment(self):
"""If Total actual amount > 100,000 need attachment with
type Final Partnership Review
"""
- file_type = FileType.objects.get(
- name=FileType.FINAL_PARTNERSHIP_REVIEW
- )
+ file_type = self.file_parnership_file_type
InterventionAttachmentFactory(
intervention=self.intervention,
type=file_type
diff --git a/EquiTrack/partners/tests/test_views.py b/EquiTrack/partners/tests/test_views.py
index 0ec6b5a31..4181d3f91 100644
--- a/EquiTrack/partners/tests/test_views.py
+++ b/EquiTrack/partners/tests/test_views.py
@@ -8,7 +8,6 @@
from urlparse import urlparse
from django.conf import settings
-from django.contrib.auth.models import Group
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse, resolve
from django.db import connection
@@ -153,6 +152,8 @@ def setUpTestData(cls):
cso_type='International',
)
+ cls.readonly_group = GroupFactory(name=READ_ONLY_API_GROUP_NAME)
+
cls.url = reverse('partners_api:partner-list')
def setUp(self):
@@ -204,7 +205,7 @@ def test_unauthenticated_user_forbidden(self):
def test_group_permission(self):
'''Ensure a non-staff user in the correct group has access'''
user = UserFactory()
- user.groups.add(Group.objects.get(name=READ_ONLY_API_GROUP_NAME))
+ user.groups.add(self.readonly_group)
response = self.forced_auth_req('get', self.url, user=user)
self.assertResponseFundamentals(response)
diff --git a/EquiTrack/publics/migrations/0001_initial.py b/EquiTrack/publics/migrations/0001_initial.py
index d6b2dfb10..ac3373733 100644
--- a/EquiTrack/publics/migrations/0001_initial.py
+++ b/EquiTrack/publics/migrations/0001_initial.py
@@ -1,9 +1,13 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-02 21:53
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
+import datetime
+import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
+import django.db.models.manager
+from django.utils.timezone import utc
class Migration(migrations.Migration):
@@ -18,141 +22,248 @@ class Migration(migrations.Migration):
name='AirlineCompany',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=255)),
- ('code', models.IntegerField()),
- ('iata', models.CharField(max_length=3)),
- ('icao', models.CharField(max_length=3)),
- ('country', models.CharField(max_length=255)),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=255, verbose_name='Name')),
+ ('code', models.IntegerField(verbose_name='Code')),
+ ('iata', models.CharField(max_length=3, verbose_name='IATA')),
+ ('icao', models.CharField(max_length=3, verbose_name='ICAO')),
+ ('country', models.CharField(max_length=255, verbose_name='Country')),
+ ],
+ options={
+ 'verbose_name_plural': 'Airline Companies',
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='BusinessArea',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=128)),
- ('code', models.CharField(max_length=32)),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=128, verbose_name='Name')),
+ ('code', models.CharField(max_length=32, verbose_name='Code')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='BusinessRegion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=16)),
- ('code', models.CharField(max_length=2)),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=16, verbose_name='Name')),
+ ('code', models.CharField(max_length=2, verbose_name='Code')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='Country',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=64)),
- ('long_name', models.CharField(max_length=128)),
- ('vision_code', models.CharField(max_length=3, null=True, unique=True)),
- ('iso_2', models.CharField(max_length=2, null=True)),
- ('iso_3', models.CharField(max_length=3, null=True)),
- ('valid_from', models.DateField(null=True)),
- ('valid_to', models.DateField(null=True)),
- ('business_area', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='countries', to='publics.BusinessArea')),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=64, verbose_name='Name')),
+ ('long_name', models.CharField(max_length=128, verbose_name='Long Name')),
+ ('vision_code', models.CharField(max_length=3, null=True, unique=True, verbose_name='Vision Code')),
+ ('iso_2', models.CharField(max_length=2, null=True, verbose_name='ISO code 2')),
+ ('iso_3', models.CharField(max_length=3, null=True, verbose_name='ISO code 3')),
+ ('dsa_code', models.CharField(max_length=3, null=True, verbose_name='DSA Code')),
+ ('valid_from', models.DateField(null=True, verbose_name='Valid From')),
+ ('valid_to', models.DateField(null=True, verbose_name='Valid To')),
+ ('business_area', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='countries', to='publics.BusinessArea', verbose_name='Business Area')),
+ ],
+ options={
+ 'verbose_name_plural': 'Countries',
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='Currency',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=128)),
- ('code', models.CharField(max_length=5)),
- ('decimal_places', models.PositiveIntegerField(default=0)),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=128, verbose_name='Name')),
+ ('code', models.CharField(max_length=5, verbose_name='Code')),
+ ('decimal_places', models.PositiveIntegerField(default=0, verbose_name='Decimal Places')),
+ ],
+ options={
+ 'verbose_name_plural': 'Currencies',
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
+ ],
+ ),
+ migrations.CreateModel(
+ name='DSARate',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('effective_from_date', models.DateField(verbose_name='Effective From Date')),
+ ('effective_to_date', models.DateField(default=datetime.date(2999, 12, 31), verbose_name='Effective To Date')),
+ ('dsa_amount_usd', models.DecimalField(decimal_places=4, max_digits=20, verbose_name='DSA amount USD')),
+ ('dsa_amount_60plus_usd', models.DecimalField(decimal_places=4, max_digits=20, verbose_name='DSA amount 60 plus USD')),
+ ('dsa_amount_local', models.DecimalField(decimal_places=4, max_digits=20, verbose_name='DSA amount local')),
+ ('dsa_amount_60plus_local', models.DecimalField(decimal_places=4, max_digits=20, verbose_name='DSA Amount 60 plus local')),
+ ('room_rate', models.DecimalField(decimal_places=4, max_digits=20, verbose_name='Zoom Rate')),
+ ('finalization_date', models.DateField(verbose_name='Finalization Date')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='DSARateUpload',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('dsa_file', models.FileField(upload_to='publics/dsa_rate/', verbose_name='DSA File')),
+ ('status', models.CharField(blank=True, choices=[('uploaded', 'Uploaded'), ('processing', 'Processing'), ('failed', 'Failed'), ('done', 'Done')], max_length=64, null=True, verbose_name='Status')),
+ ('upload_date', models.DateTimeField(auto_now_add=True, verbose_name='Upload Date')),
+ ('errors', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='Errors')),
],
),
migrations.CreateModel(
name='DSARegion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('area_name', models.CharField(max_length=120)),
- ('area_code', models.CharField(max_length=3)),
- ('dsa_amount_usd', models.DecimalField(decimal_places=4, max_digits=20)),
- ('dsa_amount_60plus_usd', models.DecimalField(decimal_places=4, max_digits=20)),
- ('dsa_amount_local', models.DecimalField(decimal_places=4, max_digits=20)),
- ('dsa_amount_60plus_local', models.DecimalField(decimal_places=4, max_digits=20)),
- ('room_rate', models.DecimalField(decimal_places=4, max_digits=20)),
- ('finalization_date', models.DateField()),
- ('eff_date', models.DateField()),
- ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dsa_regions', to='publics.Country')),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('area_name', models.CharField(max_length=120, verbose_name='Area Name')),
+ ('area_code', models.CharField(max_length=3, verbose_name='Area Code')),
+ ('user_defined', models.BooleanField(default=False, verbose_name='Defined User')),
+ ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dsa_regions', to='publics.Country', verbose_name='Country')),
],
+ options={
+ 'abstract': False,
+ },
),
migrations.CreateModel(
name='ExchangeRate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('valid_from', models.DateField()),
- ('valid_to', models.DateField()),
- ('x_rate', models.DecimalField(decimal_places=5, max_digits=10)),
- ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exchange_rates', to='publics.Currency')),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('valid_from', models.DateField(verbose_name='Valid From')),
+ ('valid_to', models.DateField(verbose_name='Valid To')),
+ ('x_rate', models.DecimalField(decimal_places=5, max_digits=10, verbose_name='X Rate')),
+ ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exchange_rates', to='publics.Currency', verbose_name='Currency')),
+ ],
+ options={
+ 'ordering': ('valid_from',),
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='Fund',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=25)),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=25, verbose_name='Name')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='Grant',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=25)),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=25, verbose_name='Name')),
+ ('funds', models.ManyToManyField(related_name='grants', to='publics.Fund', verbose_name='Funds')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='TravelAgent',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=128)),
- ('code', models.CharField(max_length=12)),
- ('city', models.CharField(max_length=128, null=True)),
- ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='publics.Country')),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=128, verbose_name='Name')),
+ ('code', models.CharField(max_length=128, verbose_name='Code')),
+ ('city', models.CharField(max_length=128, null=True, verbose_name='City')),
+ ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='publics.Country', verbose_name='Country')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name='TravelExpenseType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('title', models.CharField(max_length=32)),
- ('vendor_number', models.CharField(max_length=32)),
- ('is_travel_agent', models.BooleanField(default=False)),
- ('rank', models.PositiveIntegerField(default=100)),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('title', models.CharField(max_length=128, verbose_name='Title')),
+ ('vendor_number', models.CharField(max_length=128, verbose_name='Vendor Number')),
+ ('rank', models.PositiveIntegerField(default=100, verbose_name='Rank')),
],
options={
'ordering': ('rank', 'title'),
},
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
+ ],
),
migrations.CreateModel(
name='WBS',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=25)),
- ('business_area', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='publics.BusinessArea')),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('name', models.CharField(max_length=25, verbose_name='Name')),
+ ('business_area', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='publics.BusinessArea', verbose_name='Business Area')),
+ ('grants', models.ManyToManyField(related_name='wbs', to='publics.Grant', verbose_name='Grants')),
+ ],
+ options={
+ 'verbose_name_plural': 'WBSes',
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
],
),
migrations.AddField(
- model_name='grant',
- name='wbs',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='grants', to='publics.WBS'),
+ model_name='travelagent',
+ name='expense_type',
+ field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='travel_agent', to='publics.TravelExpenseType', verbose_name='Expense Type'),
),
migrations.AddField(
- model_name='fund',
- name='grant',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='funds', to='publics.Grant'),
+ model_name='dsarate',
+ name='region',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rates', to='publics.DSARegion', verbose_name='Region'),
),
migrations.AddField(
model_name='country',
name='currency',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='publics.Currency'),
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='publics.Currency', verbose_name='Currency'),
+ ),
+ migrations.AddField(
+ model_name='businessarea',
+ name='default_currency',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency', verbose_name='Default Currency'),
),
migrations.AddField(
model_name='businessarea',
name='region',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='business_areas', to='publics.BusinessRegion'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='business_areas', to='publics.BusinessRegion', verbose_name='Region'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='dsarate',
+ unique_together=set([('region', 'effective_to_date')]),
),
]
diff --git a/EquiTrack/publics/migrations/0002_auto_20170206_2105.py b/EquiTrack/publics/migrations/0002_auto_20170206_2105.py
deleted file mode 100644
index 2cc0bfeae..000000000
--- a/EquiTrack/publics/migrations/0002_auto_20170206_2105.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-06 19:05
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='travelexpensetype',
- name='title',
- field=models.CharField(max_length=128),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0003_businessarea_default_currency.py b/EquiTrack/publics/migrations/0003_businessarea_default_currency.py
deleted file mode 100644
index b61eba1c2..000000000
--- a/EquiTrack/publics/migrations/0003_businessarea_default_currency.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-07 16:14
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0002_auto_20170206_2105'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='businessarea',
- name='default_currency',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency'),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0004_auto_20170207_1814.py b/EquiTrack/publics/migrations/0004_auto_20170207_1814.py
deleted file mode 100644
index 2ce7ef6e1..000000000
--- a/EquiTrack/publics/migrations/0004_auto_20170207_1814.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-07 16:14
-from __future__ import unicode_literals
-
-import logging
-
-from django.db import migrations
-
-log = logging.getLogger(__name__)
-
-
-def populate_default_currency(apps, schema_editor):
- BusinessArea = apps.get_model('publics', 'BusinessArea')
-
- for business_area in BusinessArea.objects.all():
- countries = business_area.countries.all()
- if countries.count() != 1:
- log.error('Cannot assign default currency to business area %s - %s', business_area.id, business_area.name)
- continue
-
- default_currency = countries.first().currency
- business_area.default_currency = default_currency
- business_area.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0003_businessarea_default_currency'),
- ]
-
- operations = [
- migrations.RunPython(populate_default_currency),
- ]
diff --git a/EquiTrack/publics/migrations/0005_auto_20170209_2353.py b/EquiTrack/publics/migrations/0005_auto_20170209_2353.py
deleted file mode 100644
index 40781ae16..000000000
--- a/EquiTrack/publics/migrations/0005_auto_20170209_2353.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-09 21:53
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0004_auto_20170207_1814'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='exchangerate',
- options={'ordering': ('valid_from',)},
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0006_auto_20170222_0226.py b/EquiTrack/publics/migrations/0006_auto_20170222_0226.py
deleted file mode 100644
index 0bb73f44d..000000000
--- a/EquiTrack/publics/migrations/0006_auto_20170222_0226.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-22 00:26
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0005_auto_20170209_2353'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='travelagent',
- name='code',
- field=models.CharField(max_length=128),
- ),
- migrations.AlterField(
- model_name='travelexpensetype',
- name='vendor_number',
- field=models.CharField(max_length=128),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0007_auto_20170228_0205.py b/EquiTrack/publics/migrations/0007_auto_20170228_0205.py
deleted file mode 100644
index 6e411a26e..000000000
--- a/EquiTrack/publics/migrations/0007_auto_20170228_0205.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 00:05
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def delete_wbs_grant_fund(apps, schema_editor):
- WBS = apps.get_model('publics', 'WBS')
- Grant = apps.get_model('publics', 'Grant')
- Fund = apps.get_model('publics', 'Fund')
-
- Fund.objects.all().delete()
- Grant.objects.all().delete()
- WBS.objects.all().delete()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0006_auto_20170222_0226'),
- ('t2f', '0004_auto_20170228_0205'),
- ]
-
- operations = [
- migrations.RunPython(delete_wbs_grant_fund),
- ]
diff --git a/EquiTrack/publics/migrations/0008_auto_20170228_0248.py b/EquiTrack/publics/migrations/0008_auto_20170228_0248.py
deleted file mode 100644
index e4d421dcf..000000000
--- a/EquiTrack/publics/migrations/0008_auto_20170228_0248.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 00:48
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0007_auto_20170228_0205'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='fund',
- name='grant',
- ),
- migrations.RemoveField(
- model_name='grant',
- name='wbs',
- ),
- migrations.AddField(
- model_name='grant',
- name='funds',
- field=models.ManyToManyField(related_name='grants', to='publics.Fund'),
- ),
- migrations.AddField(
- model_name='wbs',
- name='grants',
- field=models.ManyToManyField(related_name='wbs', to='publics.Grant'),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0009_travelagent_expense_type.py b/EquiTrack/publics/migrations/0009_travelagent_expense_type.py
deleted file mode 100644
index d9442b66b..000000000
--- a/EquiTrack/publics/migrations/0009_travelagent_expense_type.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 12:34
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0008_auto_20170228_0248'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='travelagent',
- name='expense_type',
- field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='travel_agent', to='publics.TravelExpenseType'),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0010_auto_20170228_1434.py b/EquiTrack/publics/migrations/0010_auto_20170228_1434.py
deleted file mode 100644
index 2f909716e..000000000
--- a/EquiTrack/publics/migrations/0010_auto_20170228_1434.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 12:34
-from __future__ import unicode_literals
-
-from django.core.exceptions import ObjectDoesNotExist
-from django.db import migrations
-
-
-def populate_travel_agent_expense_type(apps, schema_editor):
- TravelAgent = apps.get_model('publics', 'TravelAgent')
- TravelExpenseType = apps.get_model('publics', 'TravelExpenseType')
-
- for travel_agent in TravelAgent.objects.all():
- try:
- expense_type = TravelExpenseType.objects.get(vendor_number=travel_agent.code)
- except ObjectDoesNotExist:
- expense_type = TravelExpenseType.objects.create(title=travel_agent.name, vendor_number=travel_agent.code)
-
- travel_agent.expense_type = expense_type
- travel_agent.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0009_travelagent_expense_type'),
- ]
-
- operations = [
- migrations.RunPython(populate_travel_agent_expense_type),
- ]
diff --git a/EquiTrack/publics/migrations/0011_auto_20170228_1446.py b/EquiTrack/publics/migrations/0011_auto_20170228_1446.py
deleted file mode 100644
index cfdb5098d..000000000
--- a/EquiTrack/publics/migrations/0011_auto_20170228_1446.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 12:46
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0010_auto_20170228_1434'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='travelexpensetype',
- name='is_travel_agent',
- ),
- migrations.AlterField(
- model_name='travelagent',
- name='expense_type',
- field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='travel_agent', to='publics.TravelExpenseType'),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0012_auto_20170421_1406.py b/EquiTrack/publics/migrations/0012_auto_20170421_1406.py
deleted file mode 100644
index 08576b626..000000000
--- a/EquiTrack/publics/migrations/0012_auto_20170421_1406.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-21 14:06
-from __future__ import unicode_literals
-
-import datetime
-from django.db import migrations, models
-import django.db.models.manager
-from django.utils.timezone import utc
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0011_auto_20170228_1446'),
- ]
-
- operations = [
- migrations.AlterModelManagers(
- name='airlinecompany',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='businessarea',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='businessregion',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='country',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='currency',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='dsaregion',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='exchangerate',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='fund',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='grant',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='travelagent',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='travelexpensetype',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AlterModelManagers(
- name='wbs',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.AddField(
- model_name='airlinecompany',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='businessarea',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='businessregion',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='country',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='currency',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='dsaregion',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='exchangerate',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='fund',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='grant',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='travelagent',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='travelexpensetype',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- migrations.AddField(
- model_name='wbs',
- name='deleted_at',
- field=models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc)),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0013_auto_20170424_1203.py b/EquiTrack/publics/migrations/0013_auto_20170424_1203.py
deleted file mode 100644
index 941221940..000000000
--- a/EquiTrack/publics/migrations/0013_auto_20170424_1203.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-24 12:03
-from __future__ import unicode_literals
-
-import datetime
-from django.db import migrations, models
-import django.db.models.deletion
-from django.utils.timezone import utc
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0012_auto_20170421_1406'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='DSARate',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('valid_from', models.DateTimeField(auto_now_add=True)),
- ('valid_to', models.DateTimeField(default=datetime.datetime(2999, 12, 31, 23, 59, 59, tzinfo=utc))),
- ('dsa_amount_usd', models.DecimalField(decimal_places=4, max_digits=20)),
- ('dsa_amount_60plus_usd', models.DecimalField(decimal_places=4, max_digits=20)),
- ('dsa_amount_local', models.DecimalField(decimal_places=4, max_digits=20)),
- ('dsa_amount_60plus_local', models.DecimalField(decimal_places=4, max_digits=20)),
- ('room_rate', models.DecimalField(decimal_places=4, max_digits=20)),
- ('finalization_date', models.DateField()),
- ('eff_date', models.DateField()),
- ],
- ),
- migrations.AddField(
- model_name='dsaregion',
- name='user_defined',
- field=models.BooleanField(default=False),
- ),
- migrations.AddField(
- model_name='dsarate',
- name='region',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rates', to='publics.DSARegion'),
- ),
- migrations.AlterUniqueTogether(
- name='dsarate',
- unique_together=set([('region', 'valid_to')]),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0014_auto_20170424_1206.py b/EquiTrack/publics/migrations/0014_auto_20170424_1206.py
deleted file mode 100644
index 2e783c3f4..000000000
--- a/EquiTrack/publics/migrations/0014_auto_20170424_1206.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-24 12:06
-from __future__ import unicode_literals
-
-from datetime import datetime
-from pytz import UTC
-
-from django.db import migrations
-
-
-def move_dsa_data(apps, schema_editor):
- fields_to_copy = ['dsa_amount_usd',
- 'dsa_amount_60plus_usd',
- 'dsa_amount_local',
- 'dsa_amount_60plus_local',
- 'room_rate',
- 'finalization_date',
- 'eff_date']
-
- DSARegion = apps.get_model('publics', 'DSARegion')
- DSARate = apps.get_model('publics', 'DSARate')
-
- for region in DSARegion.admin_objects.all():
- valid_from = datetime(region.eff_date.year, region.eff_date.month, region.eff_date.day, tzinfo=UTC)
- rate_kwargs = {'region': region,
- 'valid_from': valid_from}
-
- for key in fields_to_copy:
- rate_kwargs[key] = getattr(region, key)
-
- DSARate.objects.create(**rate_kwargs)
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0013_auto_20170424_1203'),
- ]
-
- operations = [
- migrations.RunPython(move_dsa_data),
- ]
diff --git a/EquiTrack/publics/migrations/0015_auto_20170424_1207.py b/EquiTrack/publics/migrations/0015_auto_20170424_1207.py
deleted file mode 100644
index 7361295d2..000000000
--- a/EquiTrack/publics/migrations/0015_auto_20170424_1207.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-24 12:06
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0014_auto_20170424_1206'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='dsaregion',
- name='dsa_amount_60plus_local',
- ),
- migrations.RemoveField(
- model_name='dsaregion',
- name='dsa_amount_60plus_usd',
- ),
- migrations.RemoveField(
- model_name='dsaregion',
- name='dsa_amount_local',
- ),
- migrations.RemoveField(
- model_name='dsaregion',
- name='dsa_amount_usd',
- ),
- migrations.RemoveField(
- model_name='dsaregion',
- name='eff_date',
- ),
- migrations.RemoveField(
- model_name='dsaregion',
- name='finalization_date',
- ),
- migrations.RemoveField(
- model_name='dsaregion',
- name='room_rate',
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0016_auto_20170426_1234.py b/EquiTrack/publics/migrations/0016_auto_20170426_1234.py
deleted file mode 100644
index 246f999c5..000000000
--- a/EquiTrack/publics/migrations/0016_auto_20170426_1234.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-26 12:34
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0015_auto_20170424_1207'),
- ]
-
- operations = [
- migrations.AlterModelManagers(
- name='dsaregion',
- managers=[
- ],
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0017_auto_20170426_1317.py b/EquiTrack/publics/migrations/0017_auto_20170426_1317.py
deleted file mode 100644
index 542ec0fc7..000000000
--- a/EquiTrack/publics/migrations/0017_auto_20170426_1317.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-26 13:17
-from __future__ import unicode_literals
-
-from datetime import date
-
-from django.db import migrations
-
-
-def fix_improper_effective_from_dates(apps, schema_editor):
- DSARate = apps.get_model('publics', 'DSARate')
-
- for rate in DSARate.objects.filter(effective_from_date__year__lt=2000):
- rate.effective_from_date = date(rate.effective_from_date.year + 2000,
- rate.effective_from_date.month,
- rate.effective_from_date.day)
- rate.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0016_auto_20170426_1234'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='dsarate',
- old_name='eff_date',
- new_name='effective_from_date',
- ),
- migrations.RunPython(fix_improper_effective_from_dates),
- ]
diff --git a/EquiTrack/publics/migrations/0018_auto_20170426_1656.py b/EquiTrack/publics/migrations/0018_auto_20170426_1656.py
deleted file mode 100644
index 3f5ad27c4..000000000
--- a/EquiTrack/publics/migrations/0018_auto_20170426_1656.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-26 16:56
-from __future__ import unicode_literals
-
-import datetime
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0017_auto_20170426_1317'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='dsarate',
- old_name='valid_to',
- new_name='effective_till_date',
- ),
- migrations.AlterUniqueTogether(
- name='dsarate',
- unique_together=set([('region', 'effective_till_date')]),
- ),
- migrations.AlterField(
- model_name='dsarate',
- name='effective_till_date',
- field=models.DateField(default=datetime.date(2999, 12, 31)),
- ),
- migrations.AlterField(
- model_name='dsarate',
- name='effective_from_date',
- field=models.DateField(auto_now_add=True),
- ),
- migrations.RemoveField(
- model_name='dsarate',
- name='valid_from',
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0019_auto_20170427_1732.py b/EquiTrack/publics/migrations/0019_auto_20170427_1732.py
deleted file mode 100644
index 2c65599c6..000000000
--- a/EquiTrack/publics/migrations/0019_auto_20170427_1732.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-27 17:32
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0018_auto_20170426_1656'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='dsarate',
- name='effective_from_date',
- field=models.DateField(),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0020_auto_20170427_2055.py b/EquiTrack/publics/migrations/0020_auto_20170427_2055.py
deleted file mode 100644
index 53c51afea..000000000
--- a/EquiTrack/publics/migrations/0020_auto_20170427_2055.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-27 20:55
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0019_auto_20170427_1732'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='dsarate',
- old_name='effective_till_date',
- new_name='effective_to_date',
- ),
- migrations.AlterUniqueTogether(
- name='dsarate',
- unique_together=set([('region', 'effective_to_date')]),
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0021_dsarateupload.py b/EquiTrack/publics/migrations/0021_dsarateupload.py
deleted file mode 100644
index eb297d0b9..000000000
--- a/EquiTrack/publics/migrations/0021_dsarateupload.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-11 12:57
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0020_auto_20170427_2055'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='DSARateUpload',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('csv', models.FileField(upload_to='publics/dsa_rate/')),
- ('status', models.CharField(blank=True, choices=[('uploaded', 'Uploaded'), ('processing', 'Processing'), ('failed', 'Failed'), ('done', 'Done')], max_length=64, null=True)),
- ('upload_date', models.DateTimeField(auto_now_add=True)),
- ('errors', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True)),
- ],
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0022_auto_20170514_1645.py b/EquiTrack/publics/migrations/0022_auto_20170514_1645.py
deleted file mode 100644
index e559721a3..000000000
--- a/EquiTrack/publics/migrations/0022_auto_20170514_1645.py
+++ /dev/null
@@ -1,251 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-14 16:45
-from __future__ import unicode_literals
-
-import logging
-
-from django.db import migrations, models
-from django.core.exceptions import ObjectDoesNotExist
-
-log = logging.getLogger(__name__)
-
-
-dsa_code_iso_mapping = [
- ('AFG', 'AFG'),
- ('ALB', 'ALB'),
- ('ALG', 'DZA'),
- ('ARG', 'ARG'),
- ('ARM', 'ARM'),
- ('AZE', 'AZE'),
- ('ANL', 'AIA'),
- ('ANT', 'ATG'),
- ('BAR', 'BRB'),
- ('BVI', 'VGB'),
- ('DMI', 'DMA'),
- ('GRN', 'GRD'),
- ('MOT', 'MSR'),
- ('STK', 'KNA'),
- ('STL', 'LCA'),
- ('STV', 'VCT'),
- ('TCI', 'TCA'),
- ('TRI', 'TTO'),
- ('BHU', 'BTN'),
- ('BOL', 'BOL'),
- ('BOT', 'BWA'),
- ('BIH', 'BIH'),
- ('BRA', 'BRA'),
- ('BUL', 'BGR'),
- ('MYA', 'MMR'),
- ('BDI', 'BDI'),
- ('BYE', 'BLR'),
- ('CMB', 'KHM'),
- ('CMR', 'CMR'),
- ('CAF', 'CAF'),
- ('SRL', 'LKA'),
- ('CHD', 'TCD'),
- ('CHI', 'CHL'),
- ('CPR', 'CHN'),
- ('COL', 'COL'),
- ('ZAI', 'COD'),
- ('COS', 'CRI'),
- ('CRO', 'HRV'),
- ('CUB', 'CUB'),
- ('BEN', 'BEN'),
- ('DEN', 'DNK'),
- ('DOM', 'DOM'),
- ('ECU', 'ECU'),
- ('ELS', 'SLV'),
- ('EQG', 'GNQ'),
- ('ETH', 'ETH'),
- ('ERI', 'ERI'),
- ('AMS', 'ASM'),
- ('CKI', 'COK'),
- ('FIJ', 'FJI'),
- ('KIR', 'KIR'),
- ('MAS', 'MHL'),
- ('MIC', 'FSM'),
- ('NAU', 'NRU'),
- ('NIU', 'NIU'),
- ('PAL', 'PLW'),
- ('SAM', 'WSM'),
- ('SOI', 'SLB'),
- ('TOK', 'TKL'),
- ('TON', 'TON'),
- ('TUV', 'TUV'),
- ('VAN', 'VUT'),
- ('GAB', 'GAB'),
- ('GAM', 'GMB'),
- ('GEO', 'GEO'),
- ('GHA', 'GHA'),
- ('GUA', 'GTM'),
- ('GUI', 'GIN'),
- ('GUY', 'GUY'),
- ('SUR', 'SUR'),
- ('HAI', 'HTI'),
- ('HON', 'HND'),
- ('IND', 'IND'),
- ('INS', 'IDN'),
- ('IRA', 'IRN'),
- ('IRQ', 'IRQ'),
- ('IVC', 'CIV'),
- ('JAM', 'JAM'),
- ('JOR', 'JOR'),
- ('KAZ', 'KAZ'),
- ('KEN', 'KEN'),
- ('KYR', 'KGZ'),
- ('LAO', 'LAO'),
- ('LEB', 'LBN'),
- ('LES', 'LSO'),
- ('LIR', 'LBR'),
- ('LIB', 'LBY'),
- ('MCD', 'MKD'),
- ('MAG', 'MDG'),
- ('MLW', 'MWI'),
- ('MAL', 'MYS'),
- ('MDV', 'MDV'),
- ('MLI', 'MLI'),
- ('MAU', 'MRT'),
- ('MEX', 'MEX'),
- ('MON', 'MNG'),
- ('MOR', 'MAR'),
- ('NEP', 'NPL'),
- ('NIC', 'NIC'),
- ('NER', 'NER'),
- ('NIR', 'NGA'),
- ('PAK', 'PAK'),
- ('PAN', 'PAN'),
- ('PAR', 'PRY'),
- ('PRC', 'COG'),
- ('PER', 'PER'),
- ('PHI', 'PHL'),
- ('ROM', 'ROU'),
- ('RUS', 'RUS'),
- ('RWA', 'RWA'),
- ('BAH', 'BHR'),
- ('KUW', 'KWT'),
- ('QAT', 'QAT'),
- ('SAU', 'SAU'),
- ('UAE', 'ARE'),
- ('SEN', 'SEN'),
- ('SIL', 'SLE'),
- ('SOM', 'SOM'),
- ('SAF', 'ZAF'),
- ('SUD', 'SDN'),
- ('SWA', 'SWZ'),
- ('SSD', 'SSD'),
- ('SYR', 'SYR'),
- ('TAJ', 'TJK'),
- ('THA', 'THA'),
- ('TOG', 'TGO'),
- ('TUN', 'TUN'),
- ('TUR', 'TUR'),
- ('TUK', 'TKM'),
- ('UGA', 'UGA'),
- ('UKR', 'UKR'),
- ('EGY', 'EGY'),
- ('URT', 'TZA'),
- ('BKF', 'BFA'),
- ('URU', 'URY'),
- ('UZB', 'UZB'),
- ('VEN', 'VEN'),
- ('YEM', 'YEM'),
- ('ZAM', 'ZMB'),
- ('BGD', 'BGD'),
- ('DRK', 'PRK'),
- ('VIE', 'VNM'),
- ('MOL', 'MDA'),
- ('SWI', 'CHE'),
- ('BZE', 'BLZ'),
- ('ZIM', 'ZWE'),
- ('OMA', 'OMN'),
- ('PNG', 'PNG'),
- ('COI', 'COM'),
- ('DJI', 'DJI'),
- ('ANG', 'AGO'),
- ('CVI', 'CPV'),
- ('STP', 'STP'),
- ('GBS', 'GNB'),
- ('MOZ', 'MOZ'),
- ('NAM', 'NAM'),
- ('OCT', 'PSE'),
- ('TIM', 'TLS'),
- ('MNE', 'MNE'),
- ('SRB', 'SRB'),
- ('ARU', 'ABW'),
- ('AUL', 'AUS'),
- ('AUS', 'AUT'),
- ('BEL', 'BEL'),
- ('BER', 'BMU'),
- ('BHA', 'BHS'),
- ('BRU', 'BRN'),
- ('CAN', 'CAN'),
- ('CAY', 'CYM'),
- ('CEH', 'CZE'),
- ('CYP', 'CYP'),
- ('EST', 'EST'),
- ('FIN', 'FIN'),
- ('FRA', 'FRA'),
- ('GER', 'DEU'),
- ('GIB', 'GIB'),
- ('GRE', 'GRC'),
- ('GUM', 'GUM'),
- ('HOK', 'HKG'),
- ('HUN', 'HUN'),
- ('ICE', 'ISL'),
- ('IRE', 'IRL'),
- ('ISR', 'ISR'),
- ('ITA', 'ITA'),
- ('JPN', 'JPN'),
- ('LAT', 'LVA'),
- ('LIT', 'LTU'),
- ('LUX', 'LUX'),
- ('MAC', 'MAC'),
- ('MAR', 'MUS'),
- ('MAT', 'MLT'),
- ('MNC', 'MCO'),
- ('NCA', 'NCL'),
- ('NET', 'NLD'),
- ('NOR', 'NOR'),
- ('NZE', 'NZL'),
- ('POL', 'POL'),
- ('POR', 'PRT'),
- ('PUE', 'PRI'),
- ('ROK', 'KOR'),
- ('SAH', 'ESH'),
- ('SEY', 'SYC'),
- ('SIN', 'SGP'),
- ('SLO', 'SVK'),
- ('SPA', 'ESP'),
- ('SVN', 'SVN'),
- ('SWE', 'SWE'),
- ('GB', 'GBP'),
- ('USA', 'USA'),
- ('UVI', 'VIR')
-]
-
-def insert_dsa_codes(apps, schema_editor):
- Country = apps.get_model('publics', 'Country')
- for dsa_code, iso_code in dsa_code_iso_mapping:
- Country.objects.filter(iso_3=iso_code).update(dsa_code=dsa_code)
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0021_dsarateupload'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='country',
- name='dsa_code',
- field=models.CharField(max_length=3, null=True),
- ),
- # There's an issue without this: AttributeError: type object 'Country' has no attribute 'objects'
- # https://github.com/django-mptt/django-mptt/issues/489#issuecomment-251929575
- migrations.AlterModelManagers(
- name='country',
- managers=[],
- ),
- migrations.RunPython(insert_dsa_codes)
- ]
diff --git a/EquiTrack/publics/migrations/0023_auto_20170525_1947.py b/EquiTrack/publics/migrations/0023_auto_20170525_1947.py
deleted file mode 100644
index 84ca12026..000000000
--- a/EquiTrack/publics/migrations/0023_auto_20170525_1947.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-25 19:47
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django.db.models.manager
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0022_auto_20170514_1645'),
- ]
-
- operations = [
- migrations.AlterModelManagers(
- name='country',
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0024_auto_20170526_1600.py b/EquiTrack/publics/migrations/0024_auto_20170526_1600.py
deleted file mode 100644
index 841d4b12e..000000000
--- a/EquiTrack/publics/migrations/0024_auto_20170526_1600.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-26 16:00
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0023_auto_20170525_1947'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='dsarateupload',
- old_name='csv',
- new_name='dsa_file',
- ),
- ]
diff --git a/EquiTrack/publics/migrations/0025_auto_20180309_1210.py b/EquiTrack/publics/migrations/0025_auto_20180309_1210.py
deleted file mode 100644
index 7a5972bc6..000000000
--- a/EquiTrack/publics/migrations/0025_auto_20180309_1210.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-09 12:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0024_auto_20170526_1600'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='airlinecompany',
- options={'verbose_name_plural': 'Airline Companies'},
- ),
- migrations.AlterModelOptions(
- name='country',
- options={'verbose_name_plural': 'Countries'},
- ),
- migrations.AlterModelOptions(
- name='currency',
- options={'verbose_name_plural': 'Currencies'},
- ),
- migrations.AlterModelOptions(
- name='wbs',
- options={'verbose_name_plural': 'WBSes'},
- ),
- ]
diff --git a/EquiTrack/publics/models.py b/EquiTrack/publics/models.py
index 6923d2b33..bc58caf08 100644
--- a/EquiTrack/publics/models.py
+++ b/EquiTrack/publics/models.py
@@ -50,7 +50,7 @@ class SoftDeleteMixin(models.Model):
to one which actually deletes the entity from the database
"""
- deleted_at = models.DateTimeField(default=EPOCH_ZERO)
+ deleted_at = models.DateTimeField(default=EPOCH_ZERO, verbose_name='Deleted At')
# IMPORTANT: The order of these two queryset is important. The normal queryset has to be defined first to have that
# as a default queryset
@@ -66,11 +66,12 @@ def delete(self, *args, **kwargs):
class TravelAgent(SoftDeleteMixin, models.Model):
- name = models.CharField(max_length=128)
- code = models.CharField(max_length=128)
- city = models.CharField(max_length=128, null=True)
- country = models.ForeignKey('publics.Country')
- expense_type = models.OneToOneField('TravelExpenseType', related_name='travel_agent')
+ name = models.CharField(max_length=128, verbose_name=_('Name'))
+ code = models.CharField(max_length=128, verbose_name=_('Code'))
+ city = models.CharField(max_length=128, null=True, verbose_name=_('City'))
+ country = models.ForeignKey('publics.Country', verbose_name=_('Country'))
+ expense_type = models.OneToOneField('TravelExpenseType', related_name='travel_agent',
+ verbose_name=_('Expense Type'))
@python_2_unicode_compatible
@@ -78,9 +79,9 @@ class TravelExpenseType(SoftDeleteMixin, models.Model):
# User related expense types have this placeholder as the vendor code
USER_VENDOR_NUMBER_PLACEHOLDER = 'user'
- title = models.CharField(max_length=128)
- vendor_number = models.CharField(max_length=128)
- rank = models.PositiveIntegerField(default=100)
+ title = models.CharField(max_length=128, verbose_name=_('Title'))
+ vendor_number = models.CharField(max_length=128, verbose_name=_('Vendor Number'))
+ rank = models.PositiveIntegerField(default=100, verbose_name=_('Rank'))
class Meta:
ordering = ('rank', 'title')
@@ -98,9 +99,9 @@ def __str__(self):
@python_2_unicode_compatible
class Currency(SoftDeleteMixin, models.Model):
- name = models.CharField(max_length=128)
- code = models.CharField(max_length=5)
- decimal_places = models.PositiveIntegerField(default=0)
+ name = models.CharField(max_length=128, verbose_name=_('Name'))
+ code = models.CharField(max_length=5, verbose_name=_('Code'))
+ decimal_places = models.PositiveIntegerField(default=0, verbose_name=_('Decimal Places'))
class Meta:
verbose_name_plural = _('Currencies')
@@ -110,10 +111,10 @@ def __str__(self):
class ExchangeRate(SoftDeleteMixin, models.Model):
- currency = models.ForeignKey('publics.Currency', related_name='exchange_rates')
- valid_from = models.DateField()
- valid_to = models.DateField()
- x_rate = models.DecimalField(max_digits=10, decimal_places=5)
+ currency = models.ForeignKey('publics.Currency', related_name='exchange_rates', verbose_name=_('Currency'))
+ valid_from = models.DateField(verbose_name=_('Valid From'))
+ valid_to = models.DateField(verbose_name=_('Valid To'))
+ x_rate = models.DecimalField(max_digits=10, decimal_places=5, verbose_name=_('X Rate'))
class Meta:
ordering = ('valid_from',)
@@ -122,11 +123,11 @@ class Meta:
@python_2_unicode_compatible
class AirlineCompany(SoftDeleteMixin, models.Model):
# This will be populated from vision
- name = models.CharField(max_length=255)
- code = models.IntegerField()
- iata = models.CharField(max_length=3)
- icao = models.CharField(max_length=3)
- country = models.CharField(max_length=255)
+ name = models.CharField(max_length=255, verbose_name=_('Name'))
+ code = models.IntegerField(verbose_name=_('Code'))
+ iata = models.CharField(max_length=3, verbose_name=_('IATA'))
+ icao = models.CharField(max_length=3, verbose_name=_('ICAO'))
+ country = models.CharField(max_length=255, verbose_name=_('Country'))
class Meta:
verbose_name_plural = _('Airline Companies')
@@ -137,8 +138,8 @@ def __str__(self):
@python_2_unicode_compatible
class BusinessRegion(SoftDeleteMixin, models.Model):
- name = models.CharField(max_length=16)
- code = models.CharField(max_length=2)
+ name = models.CharField(max_length=16, verbose_name=_('Name'))
+ code = models.CharField(max_length=2, verbose_name=_('Code'))
def __str__(self):
return self.name
@@ -146,10 +147,10 @@ def __str__(self):
@python_2_unicode_compatible
class BusinessArea(SoftDeleteMixin, models.Model):
- name = models.CharField(max_length=128)
- code = models.CharField(max_length=32)
- region = models.ForeignKey('BusinessRegion', related_name='business_areas')
- default_currency = models.ForeignKey('Currency', related_name='+', null=True)
+ name = models.CharField(max_length=128, verbose_name=_('Name'))
+ code = models.CharField(max_length=32, verbose_name=_('Code'))
+ region = models.ForeignKey('BusinessRegion', related_name='business_areas', verbose_name=_('Region'))
+ default_currency = models.ForeignKey('Currency', related_name='+', null=True, verbose_name=_('Default Currency'))
def __str__(self):
return self.name
@@ -157,9 +158,9 @@ def __str__(self):
@python_2_unicode_compatible
class WBS(SoftDeleteMixin, models.Model):
- business_area = models.ForeignKey('BusinessArea', null=True)
- name = models.CharField(max_length=25)
- grants = models.ManyToManyField('Grant', related_name='wbs')
+ business_area = models.ForeignKey('BusinessArea', null=True, verbose_name=_('Business Area'))
+ name = models.CharField(max_length=25, verbose_name=_('Name'))
+ grants = models.ManyToManyField('Grant', related_name='wbs', verbose_name=_('Grants'))
class Meta:
verbose_name_plural = _('WBSes')
@@ -170,8 +171,8 @@ def __str__(self):
@python_2_unicode_compatible
class Grant(SoftDeleteMixin, models.Model):
- name = models.CharField(max_length=25)
- funds = models.ManyToManyField('Fund', related_name='grants')
+ name = models.CharField(max_length=25, verbose_name=_('Name'))
+ funds = models.ManyToManyField('Fund', related_name='grants', verbose_name=_('Funds'))
def __str__(self):
return self.name
@@ -179,7 +180,7 @@ def __str__(self):
@python_2_unicode_compatible
class Fund(SoftDeleteMixin, models.Model):
- name = models.CharField(max_length=25)
+ name = models.CharField(max_length=25, verbose_name=_('Name'))
def __str__(self):
return self.name
@@ -187,16 +188,17 @@ def __str__(self):
@python_2_unicode_compatible
class Country(SoftDeleteMixin, models.Model):
- name = models.CharField(max_length=64)
- long_name = models.CharField(max_length=128)
- business_area = models.ForeignKey('BusinessArea', related_name='countries', null=True)
- vision_code = models.CharField(max_length=3, null=True, unique=True)
- iso_2 = models.CharField(max_length=2, null=True)
- iso_3 = models.CharField(max_length=3, null=True)
- dsa_code = models.CharField(max_length=3, null=True)
- currency = models.ForeignKey('Currency', null=True)
- valid_from = models.DateField(null=True)
- valid_to = models.DateField(null=True)
+ name = models.CharField(max_length=64, verbose_name=_('Name'))
+ long_name = models.CharField(max_length=128, verbose_name=_('Long Name'))
+ business_area = models.ForeignKey('BusinessArea', related_name='countries', null=True,
+ verbose_name=_('Business Area'))
+ vision_code = models.CharField(max_length=3, null=True, unique=True, verbose_name=_('Vision Code'))
+ iso_2 = models.CharField(max_length=2, null=True, verbose_name=_('ISO code 2'))
+ iso_3 = models.CharField(max_length=3, null=True, verbose_name=_('ISO code 3'))
+ dsa_code = models.CharField(max_length=3, null=True, verbose_name=_('DSA Code'))
+ currency = models.ForeignKey('Currency', null=True, verbose_name=_('Currency'))
+ valid_from = models.DateField(null=True, verbose_name=_('Valid From'))
+ valid_to = models.DateField(null=True, verbose_name=_('Valid To'))
class Meta:
verbose_name_plural = _('Countries')
@@ -219,10 +221,10 @@ def delete(self):
@python_2_unicode_compatible
class DSARegion(SoftDeleteMixin, models.Model):
- country = models.ForeignKey('Country', related_name='dsa_regions')
- area_name = models.CharField(max_length=120)
- area_code = models.CharField(max_length=3)
- user_defined = models.BooleanField(default=False)
+ country = models.ForeignKey('Country', related_name='dsa_regions', verbose_name=_('Country'))
+ area_name = models.CharField(max_length=120, verbose_name=_('Area Name'))
+ area_code = models.CharField(max_length=3, verbose_name=_('Area Code'))
+ user_defined = models.BooleanField(default=False, verbose_name=_('Defined User'))
objects = DSARegionQuerySet.as_manager()
@@ -271,17 +273,19 @@ def expire(self):
class DSARate(models.Model):
DEFAULT_EFFECTIVE_TILL = date(2999, 12, 31)
- region = models.ForeignKey('DSARegion', related_name='rates')
- effective_from_date = models.DateField()
- effective_to_date = models.DateField(default=DEFAULT_EFFECTIVE_TILL)
+ region = models.ForeignKey('DSARegion', related_name='rates', verbose_name=_('Region'))
+ effective_from_date = models.DateField(verbose_name=_('Effective From Date'))
+ effective_to_date = models.DateField(default=DEFAULT_EFFECTIVE_TILL, verbose_name=_('Effective To Date'))
- dsa_amount_usd = models.DecimalField(max_digits=20, decimal_places=4)
- dsa_amount_60plus_usd = models.DecimalField(max_digits=20, decimal_places=4)
- dsa_amount_local = models.DecimalField(max_digits=20, decimal_places=4)
- dsa_amount_60plus_local = models.DecimalField(max_digits=20, decimal_places=4)
+ dsa_amount_usd = models.DecimalField(max_digits=20, decimal_places=4, verbose_name=_('DSA amount USD'))
+ dsa_amount_60plus_usd = models.DecimalField(max_digits=20, decimal_places=4,
+ verbose_name=_('DSA amount 60 plus USD'))
+ dsa_amount_local = models.DecimalField(max_digits=20, decimal_places=4, verbose_name=_('DSA amount local'))
+ dsa_amount_60plus_local = models.DecimalField(max_digits=20, decimal_places=4,
+ verbose_name=_('DSA Amount 60 plus local'))
- room_rate = models.DecimalField(max_digits=20, decimal_places=4)
- finalization_date = models.DateField()
+ room_rate = models.DecimalField(max_digits=20, decimal_places=4, verbose_name=_('Zoom Rate'))
+ finalization_date = models.DateField(verbose_name=_('Finalization Date'))
objects = DSARateQuerySet.as_manager()
@@ -325,15 +329,16 @@ class DSARateUpload(models.Model):
(DONE, 'Done'),
)
- dsa_file = models.FileField(upload_to="publics/dsa_rate/")
+ dsa_file = models.FileField(upload_to="publics/dsa_rate/", verbose_name=_('DSA File'))
status = models.CharField(
max_length=64,
blank=True,
null=True,
- choices=STATUS
+ choices=STATUS,
+ verbose_name=_('Status')
)
- upload_date = models.DateTimeField(auto_now_add=True)
- errors = JSONField(blank=True, null=True, default=dict)
+ upload_date = models.DateTimeField(auto_now_add=True, verbose_name=_('Upload Date'))
+ errors = JSONField(blank=True, null=True, default=dict, verbose_name=_('Errors'))
def save(self, *args, **kwargs):
if not self.pk:
diff --git a/EquiTrack/reports/migrations/0001_initial.py b/EquiTrack/reports/migrations/0001_initial.py
index 00d583d62..d7598cb34 100644
--- a/EquiTrack/reports/migrations/0001_initial.py
+++ b/EquiTrack/reports/migrations/0001_initial.py
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:22
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
+import django.utils.timezone
+import model_utils.fields
import mptt.fields
@@ -12,98 +14,161 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
+ ('locations', '0001_initial'),
+ ('partners', '0001_initial'),
]
operations = [
+ migrations.CreateModel(
+ name='AppliedIndicator',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('cluster_indicator_id', models.PositiveIntegerField(blank=True, null=True, verbose_name='Cluster Indicator ID')),
+ ('response_plan_name', models.CharField(blank=True, max_length=1024, null=True, verbose_name='Response plan name')),
+ ('cluster_name', models.CharField(blank=True, max_length=512, null=True, verbose_name='Cluster Name')),
+ ('cluster_indicator_title', models.CharField(blank=True, max_length=1024, null=True, verbose_name='Cluster Indicator Title')),
+ ('context_code', models.CharField(blank=True, max_length=50, null=True, verbose_name='Code in current context')),
+ ('target', models.PositiveIntegerField(default=0, verbose_name='Target')),
+ ('baseline', models.PositiveIntegerField(blank=True, null=True, verbose_name='Baseline')),
+ ('assumptions', models.TextField(blank=True, null=True, verbose_name='Assumptions')),
+ ('means_of_verification', models.CharField(blank=True, max_length=255, null=True, verbose_name='Means of Verification')),
+ ('total', models.IntegerField(blank=True, default=0, null=True, verbose_name='Current Total')),
+ ],
+ ),
migrations.CreateModel(
name='CountryProgramme',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=150)),
- ('wbs', models.CharField(max_length=30, unique=True)),
- ('from_date', models.DateField()),
- ('to_date', models.DateField()),
+ ('name', models.CharField(max_length=150, verbose_name='Name')),
+ ('wbs', models.CharField(max_length=30, unique=True, verbose_name='WBS')),
+ ('invalid', models.BooleanField(default=False, verbose_name='Invalid')),
+ ('from_date', models.DateField(verbose_name='From Date')),
+ ('to_date', models.DateField(verbose_name='To Date')),
],
),
migrations.CreateModel(
- name='Goal',
+ name='Disaggregation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=512L, unique=True)),
- ('description', models.CharField(blank=True, max_length=512L)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('name', models.CharField(max_length=255, unique=True, verbose_name='Name')),
+ ('active', models.BooleanField(default=False, verbose_name='Active')),
],
options={
- 'ordering': ['name'],
- 'verbose_name': 'CCC',
+ 'abstract': False,
+ },
+ ),
+ migrations.CreateModel(
+ name='DisaggregationValue',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('value', models.CharField(max_length=15, verbose_name='Value')),
+ ('active', models.BooleanField(default=False, verbose_name='Active')),
+ ('disaggregation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='disaggregation_values', to='reports.Disaggregation', verbose_name='Disaggregation')),
+ ],
+ options={
+ 'abstract': False,
},
),
migrations.CreateModel(
name='Indicator',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=1024)),
- ('code', models.CharField(blank=True, max_length=50, null=True)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('name', models.CharField(max_length=1024, verbose_name='Name')),
+ ('code', models.CharField(blank=True, max_length=50, null=True, verbose_name='Code')),
('total', models.IntegerField(blank=True, null=True, verbose_name='UNICEF Target')),
('sector_total', models.IntegerField(blank=True, null=True, verbose_name='Sector Target')),
- ('current', models.IntegerField(blank=True, default=0, null=True)),
- ('sector_current', models.IntegerField(blank=True, null=True)),
- ('assumptions', models.TextField(blank=True, null=True)),
- ('target', models.CharField(blank=True, max_length=255, null=True)),
- ('baseline', models.CharField(blank=True, max_length=255, null=True)),
- ('ram_indicator', models.BooleanField(default=False)),
- ('view_on_dashboard', models.BooleanField(default=False)),
- ('in_activity_info', models.BooleanField(default=False)),
+ ('current', models.IntegerField(blank=True, default=0, null=True, verbose_name='Current')),
+ ('sector_current', models.IntegerField(blank=True, null=True, verbose_name='Sector Current')),
+ ('assumptions', models.TextField(blank=True, null=True, verbose_name='Assumptions')),
+ ('target', models.CharField(blank=True, max_length=255, null=True, verbose_name='Target')),
+ ('baseline', models.CharField(blank=True, max_length=255, null=True, verbose_name='Baseline')),
+ ('ram_indicator', models.BooleanField(default=False, verbose_name='RAM Indicator')),
+ ('active', models.BooleanField(default=True, verbose_name='Active')),
+ ('view_on_dashboard', models.BooleanField(default=False, verbose_name='View on Dashboard')),
],
options={
- 'ordering': ['name'],
+ 'ordering': ['-active', 'name'],
},
),
migrations.CreateModel(
- name='Milestone',
+ name='IndicatorBlueprint',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('description', models.TextField()),
- ('assumptions', models.TextField(blank=True, null=True)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('title', models.CharField(max_length=1024, verbose_name='Title')),
+ ('unit', models.CharField(choices=[('number', 'number'), ('percentage', 'percentage')], default='number', max_length=10, verbose_name='Unit')),
+ ('description', models.CharField(blank=True, max_length=3072, null=True, verbose_name='Description')),
+ ('code', models.CharField(blank=True, max_length=50, null=True, unique=True, verbose_name='Code')),
+ ('subdomain', models.CharField(blank=True, max_length=255, null=True, verbose_name='Subdomain')),
+ ('disaggregatable', models.BooleanField(default=False, verbose_name='Disaggregatable')),
+ ('calculation_formula_across_periods', models.CharField(choices=[('sum', 'sum'), ('max', 'max'), ('avg', 'avg'), ('percentage', 'percentage'), ('ratio', 'ratio')], default='sum', max_length=10, verbose_name='Calculation Formula across Periods')),
+ ('calculation_formula_across_locations', models.CharField(choices=[('sum', 'sum'), ('max', 'max'), ('avg', 'avg'), ('percentage', 'percentage'), ('ratio', 'ratio')], default='sum', max_length=10, verbose_name='Calculation Formula across Locations')),
+ ('display_type', models.CharField(choices=[('number', 'number'), ('percentage', 'percentage'), ('ratio', 'ratio')], default='number', max_length=10, verbose_name='Display Type')),
],
+ options={
+ 'ordering': ['-id'],
+ },
),
migrations.CreateModel(
- name='Result',
+ name='LowerResult',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.TextField()),
- ('code', models.CharField(blank=True, max_length=50, null=True)),
- ('from_date', models.DateField(blank=True, null=True)),
- ('to_date', models.DateField(blank=True, null=True)),
- ('humanitarian_tag', models.BooleanField(default=False)),
- ('wbs', models.CharField(blank=True, max_length=50, null=True)),
- ('vision_id', models.CharField(blank=True, max_length=10, null=True)),
- ('gic_code', models.CharField(blank=True, max_length=8, null=True)),
- ('gic_name', models.CharField(blank=True, max_length=255, null=True)),
- ('sic_code', models.CharField(blank=True, max_length=8, null=True)),
- ('sic_name', models.CharField(blank=True, max_length=255, null=True)),
- ('activity_focus_code', models.CharField(blank=True, max_length=8, null=True)),
- ('activity_focus_name', models.CharField(blank=True, max_length=255, null=True)),
- ('hidden', models.BooleanField(default=False)),
- ('ram', models.BooleanField(default=False)),
- ('lft', models.PositiveIntegerField(db_index=True, editable=False)),
- ('rght', models.PositiveIntegerField(db_index=True, editable=False)),
- ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
- ('level', models.PositiveIntegerField(db_index=True, editable=False)),
- ('country_programme', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.CountryProgramme')),
- ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='reports.Result')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('name', models.CharField(max_length=500, verbose_name='Name')),
+ ('code', models.CharField(max_length=50, verbose_name='Code')),
+ ('result_link', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ll_results', to='partners.InterventionResultLink', verbose_name='Result Link')),
],
options={
- 'ordering': ['name'],
+ 'ordering': ('-created',),
},
),
migrations.CreateModel(
- name='ResultStructure',
+ name='Quarter',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=150)),
- ('from_date', models.DateField()),
- ('to_date', models.DateField()),
- ('country_programme', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.CountryProgramme')),
+ ('name', models.CharField(choices=[('Q1', 'Quarter 1'), ('Q2', 'Quarter 2'), ('Q3', 'Quarter 3'), ('Q4', 'Quarter 4')], max_length=64, verbose_name='Name')),
+ ('year', models.CharField(max_length=4, verbose_name='Year')),
+ ('start_date', models.DateTimeField(verbose_name='Start Date')),
+ ('end_date', models.DateTimeField(verbose_name='End Date')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Result',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.TextField(verbose_name='Name')),
+ ('code', models.CharField(blank=True, max_length=50, null=True, verbose_name='Code')),
+ ('from_date', models.DateField(blank=True, null=True, verbose_name='From Date')),
+ ('to_date', models.DateField(blank=True, null=True, verbose_name='To Date')),
+ ('humanitarian_tag', models.BooleanField(default=False, verbose_name='Humanitarian Tag')),
+ ('wbs', models.CharField(blank=True, max_length=50, null=True, verbose_name='WBS')),
+ ('vision_id', models.CharField(blank=True, max_length=10, null=True, verbose_name='VISION ID')),
+ ('gic_code', models.CharField(blank=True, max_length=8, null=True, verbose_name='GIC Code')),
+ ('gic_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='GIC Name')),
+ ('sic_code', models.CharField(blank=True, max_length=8, null=True, verbose_name='SIC Code')),
+ ('sic_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='SIC Name')),
+ ('activity_focus_code', models.CharField(blank=True, max_length=8, null=True, verbose_name='Activity Focus Code')),
+ ('activity_focus_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='Activity Focus Code')),
+ ('hidden', models.BooleanField(default=False, verbose_name='Hidden')),
+ ('ram', models.BooleanField(default=False, verbose_name='RAM')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('lft', models.PositiveIntegerField(db_index=True, editable=False)),
+ ('rght', models.PositiveIntegerField(db_index=True, editable=False)),
+ ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
+ ('level', models.PositiveIntegerField(db_index=True, editable=False)),
+ ('country_programme', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.CountryProgramme', verbose_name='Country Programme')),
+ ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='reports.Result', verbose_name='Parent')),
],
options={
'ordering': ['name'],
@@ -113,19 +178,21 @@ class Migration(migrations.Migration):
name='ResultType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(choices=[('Outcome', 'Outcome'), ('Output', 'Output'), ('Activity', 'Activity'), ('Sub-Activity', 'Sub-Activity')], max_length=150, unique=True)),
+ ('name', models.CharField(choices=[('Outcome', 'Outcome'), ('Output', 'Output'), ('Activity', 'Activity')], max_length=150, unique=True, verbose_name='Name')),
],
),
migrations.CreateModel(
name='Sector',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=45L, unique=True)),
- ('description', models.CharField(blank=True, max_length=256L, null=True)),
- ('alternate_id', models.IntegerField(blank=True, null=True)),
- ('alternate_name', models.CharField(blank=True, max_length=255, null=True)),
- ('dashboard', models.BooleanField(default=False)),
- ('color', models.CharField(blank=True, max_length=7, null=True)),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('name', models.CharField(max_length=45, unique=True, verbose_name='Name')),
+ ('description', models.CharField(blank=True, max_length=256, null=True, verbose_name='Description')),
+ ('alternate_id', models.IntegerField(blank=True, null=True, verbose_name='Alternate ID')),
+ ('alternate_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='Alternate Name')),
+ ('dashboard', models.BooleanField(default=False, verbose_name='Dashboard')),
+ ('color', models.CharField(blank=True, max_length=7, null=True, verbose_name='Color')),
],
options={
'ordering': ['name'],
@@ -135,72 +202,76 @@ class Migration(migrations.Migration):
name='Unit',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('type', models.CharField(max_length=45L, unique=True)),
+ ('type', models.CharField(max_length=45, unique=True, verbose_name='Type')),
],
options={
'ordering': ['type'],
},
),
- migrations.AddField(
- model_name='result',
- name='result_structure',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='reports.ResultStructure'),
- ),
migrations.AddField(
model_name='result',
name='result_type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.ResultType'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.ResultType', verbose_name='Result Type'),
),
migrations.AddField(
model_name='result',
name='sector',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Sector'),
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Sector', verbose_name='Section'),
),
migrations.AddField(
- model_name='milestone',
+ model_name='indicator',
name='result',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='milestones', to='reports.Result'),
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Result', verbose_name='Result'),
),
migrations.AddField(
model_name='indicator',
- name='result',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Result'),
+ name='sector',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Sector', verbose_name='Section'),
),
migrations.AddField(
model_name='indicator',
- name='result_structure',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='reports.ResultStructure'),
+ name='unit',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Unit', verbose_name='Unit'),
),
migrations.AddField(
- model_name='indicator',
- name='sector',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Sector'),
+ model_name='appliedindicator',
+ name='disaggregation',
+ field=models.ManyToManyField(blank=True, related_name='applied_indicators', to='reports.Disaggregation', verbose_name='Disaggregation Logic'),
),
migrations.AddField(
- model_name='indicator',
- name='unit',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Unit'),
+ model_name='appliedindicator',
+ name='indicator',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.IndicatorBlueprint', verbose_name='Indicator'),
),
migrations.AddField(
- model_name='goal',
- name='result_structure',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='reports.ResultStructure'),
+ model_name='appliedindicator',
+ name='locations',
+ field=models.ManyToManyField(related_name='applied_indicators', to='locations.Location', verbose_name='Location'),
),
migrations.AddField(
- model_name='goal',
- name='sector',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='goals', to='reports.Sector'),
+ model_name='appliedindicator',
+ name='lower_result',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='applied_indicators', to='reports.LowerResult', verbose_name='PD Result'),
),
- migrations.AlterUniqueTogether(
- name='resultstructure',
- unique_together=set([('name', 'from_date', 'to_date')]),
+ migrations.AddField(
+ model_name='appliedindicator',
+ name='section',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Sector', verbose_name='Section'),
),
migrations.AlterUniqueTogether(
name='result',
unique_together=set([('wbs', 'country_programme')]),
),
+ migrations.AlterUniqueTogether(
+ name='lowerresult',
+ unique_together=set([('result_link', 'code')]),
+ ),
migrations.AlterUniqueTogether(
name='indicator',
unique_together=set([('name', 'result', 'sector')]),
),
+ migrations.AlterUniqueTogether(
+ name='appliedindicator',
+ unique_together=set([('indicator', 'lower_result')]),
+ ),
]
diff --git a/EquiTrack/reports/migrations/0002_auto_20161209_2030.py b/EquiTrack/reports/migrations/0002_auto_20161209_2030.py
deleted file mode 100644
index 178e1ebae..000000000
--- a/EquiTrack/reports/migrations/0002_auto_20161209_2030.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-09 18:30
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations, models
-import django.db.models.deletion
-import mptt.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0003_auto_20161209_2030'),
- ('reports', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='AppliedIndicator',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('context_code', models.CharField(blank=True, max_length=50, null=True, verbose_name='Code in current context')),
- ('target', models.CharField(blank=True, max_length=255, null=True)),
- ('baseline', models.CharField(blank=True, max_length=255, null=True)),
- ('assumptions', models.TextField(blank=True, null=True)),
- ('total', models.IntegerField(blank=True, default=0, null=True, verbose_name='Current Total')),
- ('disaggregation_logic', django.contrib.postgres.fields.jsonb.JSONField(null=True)),
- ],
- ),
- migrations.CreateModel(
- name='IndicatorBlueprint',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=1024)),
- ('description', models.CharField(blank=True, max_length=3072, null=True)),
- ('code', models.CharField(blank=True, max_length=50, null=True, unique=True)),
- ('subdomain', models.CharField(blank=True, max_length=255, null=True)),
- ('disaggregatable', models.BooleanField(default=False)),
- ('unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='reports.Unit')),
- ],
- ),
- migrations.CreateModel(
- name='LowerResult',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=500)),
- ('code', models.CharField(max_length=50)),
- ('partner_contribution', models.IntegerField(blank=True, default=0, null=True)),
- ('unicef_cash', models.IntegerField(blank=True, default=0, null=True)),
- ('in_kind_amount', models.IntegerField(blank=True, default=0, null=True)),
- ('lft', models.PositiveIntegerField(db_index=True, editable=False)),
- ('rght', models.PositiveIntegerField(db_index=True, editable=False)),
- ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
- ('level', models.PositiveIntegerField(db_index=True, editable=False)),
- ('cp_result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lower_results', to='reports.Result')),
- ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PCA')),
- ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='reports.LowerResult')),
- ],
- ),
- migrations.CreateModel(
- name='Quarter',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(choices=[('Q1', 'Quarter 1'), ('Q2', 'Quarter 2'), ('Q3', 'Quarter 3'), ('Q4', 'Quarter 4')], max_length=64)),
- ('year', models.CharField(max_length=4)),
- ('start_date', models.DateTimeField()),
- ('end_date', models.DateTimeField()),
- ],
- ),
- migrations.RemoveField(
- model_name='milestone',
- name='result',
- ),
- migrations.DeleteModel(
- name='Milestone',
- ),
- migrations.AddField(
- model_name='lowerresult',
- name='quarters',
- field=models.ManyToManyField(blank=True, related_name='_lowerresult_quarters_+', to='reports.Quarter'),
- ),
- migrations.AddField(
- model_name='lowerresult',
- name='result_type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.ResultType'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='indicator',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.IndicatorBlueprint'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='lower_result',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='applied_indicators', to='reports.LowerResult'),
- ),
- migrations.AlterUniqueTogether(
- name='lowerresult',
- unique_together=set([('intervention', 'cp_result', 'code')]),
- ),
- migrations.AlterUniqueTogether(
- name='appliedindicator',
- unique_together=set([('indicator', 'lower_result')]),
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0003_auto_20161227_1953.py b/EquiTrack/reports/migrations/0003_auto_20161227_1953.py
deleted file mode 100644
index ebe532b80..000000000
--- a/EquiTrack/reports/migrations/0003_auto_20161227_1953.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-27 17:53
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0005_auto_20161227_1953'),
- ('reports', '0002_auto_20161209_2030'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='lowerresult',
- name='result_link',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ll_results', to='partners.InterventionResultLink'),
- ),
- # manually moving contraints update here otherwise intervention field will not exist thanks @nik
- migrations.AlterUniqueTogether(
- name='lowerresult',
- unique_together=set([('result_link', 'code')]),
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='cp_result',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='intervention',
- ),
-
- ]
diff --git a/EquiTrack/reports/migrations/0004_auto_20170210_2206.py b/EquiTrack/reports/migrations/0004_auto_20170210_2206.py
deleted file mode 100644
index b7909d248..000000000
--- a/EquiTrack/reports/migrations/0004_auto_20170210_2206.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-10 20:06
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0003_auto_20161227_1953'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='appliedindicator',
- name='means_of_verification',
- field=models.CharField(blank=True, max_length=255, null=True),
- ),
- migrations.AlterField(
- model_name='indicatorblueprint',
- name='unit',
- field=models.CharField(choices=[('number', 'number'), ('percentage', 'percentage'), ('yesno', 'yesno')], default='number', max_length=10),
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0005_auto_20170210_2233.py b/EquiTrack/reports/migrations/0005_auto_20170210_2233.py
deleted file mode 100644
index 94aca5350..000000000
--- a/EquiTrack/reports/migrations/0005_auto_20170210_2233.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-10 20:33
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0004_auto_20170210_2206'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='lowerresult',
- name='in_kind_amount',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='level',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='lft',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='parent',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='partner_contribution',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='quarters',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='rght',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='tree_id',
- ),
- migrations.RemoveField(
- model_name='lowerresult',
- name='unicef_cash',
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0006_remove_lowerresult_result_type.py b/EquiTrack/reports/migrations/0006_remove_lowerresult_result_type.py
deleted file mode 100644
index 4b95037a3..000000000
--- a/EquiTrack/reports/migrations/0006_remove_lowerresult_result_type.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-15 14:48
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0005_auto_20170210_2233'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='lowerresult',
- name='result_type',
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0007_auto_20170215_1706.py b/EquiTrack/reports/migrations/0007_auto_20170215_1706.py
deleted file mode 100644
index 01a9f05bd..000000000
--- a/EquiTrack/reports/migrations/0007_auto_20170215_1706.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-15 15:06
-from __future__ import unicode_literals
-
-from django.db import migrations
-import django.utils.timezone
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0006_remove_lowerresult_result_type'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='lowerresult',
- options={'ordering': ('-created',)},
- ),
- migrations.AddField(
- model_name='lowerresult',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
- ),
- migrations.AddField(
- model_name='lowerresult',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0008_auto_20170330_1931.py b/EquiTrack/reports/migrations/0008_auto_20170330_1931.py
deleted file mode 100644
index 09380ff23..000000000
--- a/EquiTrack/reports/migrations/0008_auto_20170330_1931.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-30 16:31
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0007_auto_20170215_1706'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='indicator',
- name='in_activity_info',
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0009_auto_20170623_1630.py b/EquiTrack/reports/migrations/0009_auto_20170623_1630.py
deleted file mode 100644
index ca3ab4aac..000000000
--- a/EquiTrack/reports/migrations/0009_auto_20170623_1630.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-23 16:30
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0008_auto_20170330_1931'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='resulttype',
- name='name',
- field=models.CharField(choices=[('Outcome', 'Outcome'), ('Output', 'Output'), ('Activity', 'Activity')], max_length=150, unique=True),
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0010_countryprogramme_invalid.py b/EquiTrack/reports/migrations/0010_countryprogramme_invalid.py
deleted file mode 100644
index 1ec3f3993..000000000
--- a/EquiTrack/reports/migrations/0010_countryprogramme_invalid.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-31 21:08
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-def reverse(apps, schema_editor):
- pass
-
-def migrate_CPs(apps, schema_editor):
- CountryProgramme = apps.get_model('reports', 'CountryProgramme')
- # use the save method to mark invalid fields
- for cp in CountryProgramme.objects.all():
- cp.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0009_auto_20170623_1630'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='countryprogramme',
- name='invalid',
- field=models.BooleanField(default=False),
- ),
- migrations.RunPython(
- migrate_CPs, reverse_code=reverse),
- ]
diff --git a/EquiTrack/reports/migrations/0011_auto_20170614_1831.py b/EquiTrack/reports/migrations/0011_auto_20170614_1831.py
deleted file mode 100644
index 1a44369c6..000000000
--- a/EquiTrack/reports/migrations/0011_auto_20170614_1831.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-14 18:31
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0033_auto_20170614_1831'),
- ('reports', '0010_countryprogramme_invalid'),
- ]
-
- operations = [
- migrations.AlterUniqueTogether(
- name='resultstructure',
- unique_together=set([]),
- ),
- migrations.RemoveField(
- model_name='resultstructure',
- name='country_programme',
- ),
- migrations.RemoveField(
- model_name='goal',
- name='result_structure',
- ),
- migrations.RemoveField(
- model_name='indicator',
- name='result_structure',
- ),
- migrations.RemoveField(
- model_name='result',
- name='result_structure',
- ),
- migrations.DeleteModel(
- name='ResultStructure',
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0012_indicator_active.py b/EquiTrack/reports/migrations/0012_indicator_active.py
deleted file mode 100644
index e32071133..000000000
--- a/EquiTrack/reports/migrations/0012_indicator_active.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-19 13:44
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0011_auto_20170614_1831'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='indicator',
- name='active',
- field=models.BooleanField(default=True),
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0013_auto_20170829_1727.py b/EquiTrack/reports/migrations/0013_auto_20170829_1727.py
deleted file mode 100644
index 869027294..000000000
--- a/EquiTrack/reports/migrations/0013_auto_20170829_1727.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-08-29 17:27
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0012_indicator_active'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='indicator',
- options={'ordering': ['-active', 'name']},
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0014_auto_20171013_2147.py b/EquiTrack/reports/migrations/0014_auto_20171013_2147.py
deleted file mode 100644
index 23c641939..000000000
--- a/EquiTrack/reports/migrations/0014_auto_20171013_2147.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-13 21:47
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0013_auto_20170829_1727'),
- ('partners', '0053_auto_20171011_1623'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='goal',
- name='sector',
- ),
- migrations.DeleteModel(
- name='Goal',
- ),
- ]
diff --git a/EquiTrack/reports/migrations/0015_auto_20180129_1921.py b/EquiTrack/reports/migrations/0015_auto_20180129_1921.py
deleted file mode 100644
index 50139b41f..000000000
--- a/EquiTrack/reports/migrations/0015_auto_20180129_1921.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2018-01-29 19:21
-from __future__ import unicode_literals, print_function
-
-from django.db import migrations, models, connection
-from django.utils import six
-import django.utils.timezone
-import model_utils.fields
-import mptt.fields
-
-from django.db.models import Q
-
-
-def myprint(*args):
- print(*args)
- file_name = 'migration_reports_0015.txt'
- args_list = [six.text_type(arg) for arg in args]
- with open(file_name, 'ab') as f:
- f.write(', '.join(args_list))
- f.write('\n')
-
-def initiate_migrations(apps, schema_editor):
- myprint(' ######################## ', connection.schema_name)
- myprint(' ')
- AppliedIndicator = apps.get_model('reports', 'AppliedIndicator')
- IndicatorBlueprint = apps.get_model('reports', 'IndicatorBlueprint')
-
- # Delete all Applied indicators that do not have lower_results
- nind = AppliedIndicator.objects.filter(lower_result__isnull=True).all().delete()
- myprint(' Number of Applied indicators without results : ', nind)
-
- # Delete all IndicatorBlueprints that do not have applied indicators
- nind = IndicatorBlueprint.objects.filter(appliedindicator__isnull=True).all().delete()
- myprint(' Number of Blueprint indicators without Applied Indicators : ', nind)
-
-def check_fields(apps, schema_editor):
- AppliedIndicator = apps.get_model('reports', 'AppliedIndicator')
-
- ainds = AppliedIndicator.objects.all()
-
- myprint('number of applied indicators indicators checked: ', ainds.count())
-
- for aind in ainds:
- try:
- int(aind.target)
- if aind.baseline is not None:
- int(aind.baseline)
-
- assert int(aind.target) >= 0
- except:
- myprint('bad indicator: ',
- ' '.join(six.text_type(i) for i in ['id', aind.id, 'target', aind.target, 'baseline', aind.baseline,
- 'interventionid', aind.lower_result.result_link.intervention.id]))
-
- if not aind.target:
- aind.target = 0
- aind.save()
- myprint('FIXED TARGET')
-
- else:
- aind.target = aind.target.replace(',', '')
- aind.target = aind.target.replace('.', '')
- if int(aind.target) < 0:
- aind.target = 0
- aind.save()
- myprint('FIXED TARGET')
-
- if aind.baseline == '':
- aind.baseline = None
- myprint('FIXED BASELINE')
- aind.save()
- elif aind.baseline:
- aind.baseline = aind.baseline.replace(',', '')
- aind.baseline = aind.baseline.replace('.', '')
- if int(aind.baseline) < 0:
- aind.baseline = 0
- aind.save()
- myprint('FIXED BASELINE')
-
-def reverse_unit(apps, schema_editor):
- pass
- # raise Exception('YesNo indicators cannot be migrated backwards')
-
-
-def change_unit(apps, schema_editor):
- AppliedIndicator = apps.get_model('reports', 'AppliedIndicator')\
-
- # indicator blueprint unit migration (indicator type if type yes/no move to quantity, target is 1 baseline 0)
-
- yesno_indicators = AppliedIndicator.objects.filter(Q(indicator__unit='yesno') |
- Q(target='yes')).all()
-
- myprint('number of yesno indicators updated: ', yesno_indicators.count())
-
- for aind in yesno_indicators:
- aind.indicator.unit = 'number'
- aind.indicator.save()
- aind.target = 1
- aind.baseline = 0
- aind.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0006_auto_20171024_1011'),
- ('reports', '0014_auto_20171013_2147'),
- ('partners', '0058_intervention_locations'),
- ]
-
- operations = [
- migrations.RunPython(initiate_migrations, migrations.RunPython.noop),
-
- migrations.RunPython(change_unit, reverse_code=reverse_unit),
-
- migrations.RunPython(check_fields, migrations.RunPython.noop),
- ]
diff --git a/EquiTrack/reports/migrations/0016_indicators.py b/EquiTrack/reports/migrations/0016_indicators.py
deleted file mode 100644
index 83998665c..000000000
--- a/EquiTrack/reports/migrations/0016_indicators.py
+++ /dev/null
@@ -1,434 +0,0 @@
-from __future__ import unicode_literals, print_function
-
-from django.db import migrations, models, connection
-import django.db.models.deletion
-import django.utils.timezone
-from django.contrib.gis.geos import GEOSGeometry
-import model_utils.fields
-import mptt.fields
-from django.db.models import Q
-
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0006_auto_20171024_1011'),
- ('reports', '0015_auto_20180129_1921'),
- ('partners', '0058_intervention_locations'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='Disaggregation',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False,
- verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False,
- verbose_name='modified')),
- ('name', models.CharField(max_length=255, unique=True)),
- ('active', models.BooleanField(default=False)),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.CreateModel(
- name='DisaggregationValue',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False,
- verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False,
- verbose_name='modified')),
- ('value', models.CharField(max_length=15)),
- ('active', models.BooleanField(default=False)),
- ('disaggregation',
- models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='disaggregation_values',
- to='reports.Disaggregation')),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.AlterModelOptions(
- name='indicatorblueprint',
- options={'ordering': ['-id']},
- ),
- migrations.RemoveField(
- model_name='appliedindicator',
- name='disaggregation_logic',
- ),
- migrations.RenameField(
- model_name='indicatorblueprint',
- old_name='name',
- new_name='title',
- ),
- migrations.AlterField(
- model_name='indicatorblueprint',
- name='title',
- field=models.CharField(max_length=1024, verbose_name='Title'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='cluster_indicator_id',
- field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Cluster Indicator ID'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='cluster_indicator_title',
- field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='Cluster Indicator Title'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='cluster_name',
- field=models.CharField(blank=True, max_length=512, null=True, verbose_name='Cluster Name'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False,
- verbose_name='created'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='locations',
- field=models.ManyToManyField(related_name='applied_indicators', to='locations.Location',
- verbose_name='Location'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False,
- verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='response_plan_name',
- field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='Response plan name'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='section',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- to='reports.Sector', verbose_name='Section'),
- ),
- migrations.AddField(
- model_name='indicator',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False,
- verbose_name='created'),
- ),
- migrations.AddField(
- model_name='indicator',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False,
- verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='indicatorblueprint',
- name='calculation_formula_across_locations',
- field=models.CharField(
- choices=[('sum', 'sum'), ('max', 'max'), ('avg', 'avg'), ('percentage', 'percentage'),
- ('ratio', 'ratio')], default='sum', max_length=10,
- verbose_name='Calculation Formula across Locations'),
- ),
- migrations.AddField(
- model_name='indicatorblueprint',
- name='calculation_formula_across_periods',
- field=models.CharField(
- choices=[('sum', 'sum'), ('max', 'max'), ('avg', 'avg'), ('percentage', 'percentage'),
- ('ratio', 'ratio')], default='sum', max_length=10,
- verbose_name='Calculation Formula across Periods'),
- ),
- migrations.AddField(
- model_name='indicatorblueprint',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False,
- verbose_name='created'),
- ),
- migrations.AddField(
- model_name='indicatorblueprint',
- name='display_type',
- field=models.CharField(choices=[('number', 'number'), ('percentage', 'percentage'), ('ratio', 'ratio')],
- default='number', max_length=10, verbose_name='Display Type'),
- ),
- migrations.AddField(
- model_name='indicatorblueprint',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False,
- verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='result',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False,
- verbose_name='created'),
- ),
- migrations.AddField(
- model_name='result',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False,
- verbose_name='modified'),
- ),
- migrations.AddField(
- model_name='sector',
- name='created',
- field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False,
- verbose_name='created'),
- ),
- migrations.AddField(
- model_name='sector',
- name='modified',
- field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False,
- verbose_name='modified'),
- ),
- migrations.AlterField(
- model_name='appliedindicator',
- name='assumptions',
- field=models.TextField(blank=True, null=True, verbose_name='Assumptions'),
- ),
- migrations.AlterField(
- model_name='appliedindicator',
- name='baseline',
- field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Baseline'),
- ),
- migrations.AlterField(
- model_name='appliedindicator',
- name='indicator',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- to='reports.IndicatorBlueprint', verbose_name='Indicator'),
- ),
- migrations.AlterField(
- model_name='appliedindicator',
- name='lower_result',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='applied_indicators',
- to='reports.LowerResult', verbose_name='PD Result'),
- ),
- migrations.AlterField(
- model_name='appliedindicator',
- name='means_of_verification',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Means of Verification'),
- ),
- migrations.AlterField(
- model_name='appliedindicator',
- name='target',
- field=models.PositiveIntegerField(default=0, verbose_name='Target'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='active',
- field=models.BooleanField(default=True, verbose_name='Active'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='assumptions',
- field=models.TextField(blank=True, null=True, verbose_name='Assumptions'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='baseline',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Baseline'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='code',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Code'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='current',
- field=models.IntegerField(blank=True, default=0, null=True, verbose_name='Current'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='name',
- field=models.CharField(max_length=1024, verbose_name='Name'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='ram_indicator',
- field=models.BooleanField(default=False, verbose_name='RAM Indicator'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='result',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- to='reports.Result', verbose_name='Result'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='sector',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- to='reports.Sector', verbose_name='Section'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='sector_current',
- field=models.IntegerField(blank=True, null=True, verbose_name='Sector Current'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='target',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Target'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='unit',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- to='reports.Unit', verbose_name='Unit'),
- ),
- migrations.AlterField(
- model_name='indicator',
- name='view_on_dashboard',
- field=models.BooleanField(default=False, verbose_name='View on Dashboard'),
- ),
- migrations.AlterField(
- model_name='indicatorblueprint',
- name='code',
- field=models.CharField(blank=True, max_length=50, null=True, unique=True, verbose_name='Code'),
- ),
- migrations.AlterField(
- model_name='indicatorblueprint',
- name='description',
- field=models.CharField(blank=True, max_length=3072, null=True, verbose_name='Description'),
- ),
- migrations.AlterField(
- model_name='indicatorblueprint',
- name='disaggregatable',
- field=models.BooleanField(default=False, verbose_name='Disaggregatable'),
- ),
- migrations.AlterField(
- model_name='indicatorblueprint',
- name='subdomain',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Subdomain'),
- ),
- migrations.AlterField(
- model_name='indicatorblueprint',
- name='unit',
- field=models.CharField(choices=[('number', 'number'), ('percentage', 'percentage')], default='number',
- max_length=10, verbose_name='Unit'),
- ),
- migrations.AlterField(
- model_name='lowerresult',
- name='code',
- field=models.CharField(max_length=50, verbose_name='Code'),
- ),
- migrations.AlterField(
- model_name='lowerresult',
- name='name',
- field=models.CharField(max_length=500, verbose_name='Name'),
- ),
- migrations.AlterField(
- model_name='lowerresult',
- name='result_link',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ll_results',
- to='partners.InterventionResultLink'),
- ),
- migrations.AlterField(
- model_name='result',
- name='activity_focus_code',
- field=models.CharField(blank=True, max_length=8, null=True, verbose_name='Activity Focus Code'),
- ),
- migrations.AlterField(
- model_name='result',
- name='activity_focus_name',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='Activity Focus Code'),
- ),
- migrations.AlterField(
- model_name='result',
- name='code',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Code'),
- ),
- migrations.AlterField(
- model_name='result',
- name='country_programme',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- to='reports.CountryProgramme', verbose_name='Country Programme'),
- ),
- migrations.AlterField(
- model_name='result',
- name='from_date',
- field=models.DateField(blank=True, null=True, verbose_name='From Date'),
- ),
- migrations.AlterField(
- model_name='result',
- name='gic_code',
- field=models.CharField(blank=True, max_length=8, null=True, verbose_name='GIC Code'),
- ),
- migrations.AlterField(
- model_name='result',
- name='gic_name',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='GIC Name'),
- ),
- migrations.AlterField(
- model_name='result',
- name='hidden',
- field=models.BooleanField(default=False, verbose_name='Hidden'),
- ),
- migrations.AlterField(
- model_name='result',
- name='humanitarian_tag',
- field=models.BooleanField(default=False, verbose_name='Humanitarian Tag'),
- ),
- migrations.AlterField(
- model_name='result',
- name='name',
- field=models.TextField(verbose_name='Name'),
- ),
- migrations.AlterField(
- model_name='result',
- name='parent',
- field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- related_name='children', to='reports.Result', verbose_name='Parent'),
- ),
- migrations.AlterField(
- model_name='result',
- name='ram',
- field=models.BooleanField(default=False, verbose_name='RAM'),
- ),
- migrations.AlterField(
- model_name='result',
- name='result_type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.ResultType',
- verbose_name='Result Type'),
- ),
- migrations.AlterField(
- model_name='result',
- name='sector',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
- to='reports.Sector', verbose_name='Section'),
- ),
- migrations.AlterField(
- model_name='result',
- name='sic_code',
- field=models.CharField(blank=True, max_length=8, null=True, verbose_name='SIC Code'),
- ),
- migrations.AlterField(
- model_name='result',
- name='sic_name',
- field=models.CharField(blank=True, max_length=255, null=True, verbose_name='SIC Name'),
- ),
- migrations.AlterField(
- model_name='result',
- name='to_date',
- field=models.DateField(blank=True, null=True, verbose_name='To Date'),
- ),
- migrations.AlterField(
- model_name='result',
- name='vision_id',
- field=models.CharField(blank=True, max_length=10, null=True, verbose_name='VISION ID'),
- ),
- migrations.AlterField(
- model_name='result',
- name='wbs',
- field=models.CharField(blank=True, max_length=50, null=True, verbose_name='WBS'),
- ),
- migrations.AddField(
- model_name='appliedindicator',
- name='disaggregation',
- field=models.ManyToManyField(blank=True, related_name='applied_indicators', to='reports.Disaggregation',
- verbose_name='Disaggregation Logic'),
- )
- ]
diff --git a/EquiTrack/reports/migrations/0017_indicators_p2.py b/EquiTrack/reports/migrations/0017_indicators_p2.py
deleted file mode 100644
index a10fcc8fc..000000000
--- a/EquiTrack/reports/migrations/0017_indicators_p2.py
+++ /dev/null
@@ -1,103 +0,0 @@
-from __future__ import unicode_literals, print_function
-
-from django.db import migrations, models, connection
-import django.db.models.deletion
-from django.utils import six
-import django.utils.timezone
-from django.contrib.gis.geos import GEOSGeometry
-
-
-def myprint(*args):
- print(*args)
- file_name = 'migration_reports_0015.txt'
- args_list = [six.text_type(arg) for arg in args]
- with open(file_name, 'ab') as f:
- f.write(', '.join(args_list))
- f.write('\n')
-
-
-def finalize_migrations(apps, schema_editor):
- # no need for this in the test db
- if connection.schema_name == 'test':
- return
- # AppliedIndicator = apps.get_model('reports', 'AppliedIndicator')
- # Location = apps.get_model('locations', 'Location')
- # GatewayType = apps.get_model('locations', 'GatewayType')
- from locations.models import Location, GatewayType
- from reports.models import AppliedIndicator
-
- try:
- admin0 = GatewayType.objects.get_or_create(admin_level=0,
- defaults={'name': 'Country'})[0]
- except django.db.utils.IntegrityError:
- admin0 = GatewayType.objects.get(name='Country')
- admin0.admin_level = 0
- # TODO: Raise these
- # assert admin0.location_set.all().count() <= 1
- admin0.save()
-
- try:
- admin0_location = Location.objects.get(gateway__pk=admin0.pk)
-
- except Location.DoesNotExist:
- myprint('Creating a default location for the country ', connection.schema_name)
- admin0_location = Location()
- admin0_location.name = connection.schema_name.title()
- admin0_location.p_code = connection.schema_name
- admin0_location.point = GEOSGeometry('POINT(-96.876369 29.905320)')
- admin0_location.gateway = admin0
- admin0_location.save()
-
- except Location.MultipleObjectsReturned:
- # TODO: Not sure if this should be handled some other way, genevapfp
- admin0_location = Location.objects.filter(gateway__pk=admin0.pk).first()
-
- # add section to applied indicator
- ainds = AppliedIndicator.objects.prefetch_related('lower_result__result_link__intervention').all()
-
- myprint('number of indicators to update: ', ainds.count())
-
- for aind in ainds:
- intervention = aind.lower_result.result_link.intervention
-
- intervention_sections = intervention.sections.count()
- if intervention_sections > 1:
- myprint('multiple sections for this pd ', ' '.join(six.text_type(i) for i in [
- 'id', intervention.id,
- 'number', intervention.number,
- 'status', intervention.status,
- 'indicator_id', aind.id,
- #'indicator', aind.indicator.title,
- ]))
- # TODO: Raise these
- # raise Exception("this intervention has more than 1 section")
- elif intervention_sections < 1:
- myprint('no sections for this pd ', ' '.join(six.text_type(i) for i in[
- 'id', intervention.id,
- 'number', intervention.number,
- 'status', intervention.status,
- 'indicator_id', aind.id,
- #'indicator', aind.indicator.title,
- ]))
- # raise Exception("this intervention has no section")
-
- section = intervention.sections.first()
- aind.section = section
- aind.save()
-
- # add locations to applied indicator
- intervention.flat_locations.add(admin0_location)
- aind.locations.add(admin0_location)
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('locations', '0006_auto_20171024_1011'),
- ('reports', '0016_indicators'),
- ('partners', '0058_intervention_locations'),
- ]
-
- operations = [
- migrations.RunPython(finalize_migrations, reverse_code=migrations.RunPython.noop)
- ]
\ No newline at end of file
diff --git a/EquiTrack/reports/models.py b/EquiTrack/reports/models.py
index b9c1805ce..1fe0d0fa9 100644
--- a/EquiTrack/reports/models.py
+++ b/EquiTrack/reports/models.py
@@ -27,10 +27,10 @@ class Quarter(models.Model):
(Q4, 'Quarter 4'),
)
- name = models.CharField(max_length=64, choices=QUARTER_CHOICES)
- year = models.CharField(max_length=4)
- start_date = models.DateTimeField()
- end_date = models.DateTimeField()
+ name = models.CharField(max_length=64, choices=QUARTER_CHOICES, verbose_name=_('Name'))
+ year = models.CharField(max_length=4, verbose_name=_('Year'))
+ start_date = models.DateTimeField(verbose_name=_('Start Date'))
+ end_date = models.DateTimeField(verbose_name=_('End Date'))
def __repr__(self):
return '{}-{}'.format(self.name, self.year)
@@ -61,11 +61,11 @@ class CountryProgramme(models.Model):
"""
Represents a country programme cycle
"""
- name = models.CharField(max_length=150)
- wbs = models.CharField(max_length=30, unique=True)
- invalid = models.BooleanField(default=False)
- from_date = models.DateField()
- to_date = models.DateField()
+ name = models.CharField(max_length=150, verbose_name=_('Name'))
+ wbs = models.CharField(max_length=30, unique=True, verbose_name=_('WBS'))
+ invalid = models.BooleanField(default=False, verbose_name=_('Invalid'))
+ from_date = models.DateField(verbose_name=_('From Date'))
+ to_date = models.DateField(verbose_name=_('To Date'))
objects = CountryProgrammeManager()
@@ -127,7 +127,7 @@ class ResultType(models.Model):
(OUTPUT, 'Output'),
(ACTIVITY, 'Activity'),
)
- name = models.CharField(max_length=150, unique=True, choices=NAME_CHOICES)
+ name = models.CharField(max_length=150, unique=True, choices=NAME_CHOICES, verbose_name=_('Name'))
def __str__(self):
return self.name
@@ -139,25 +139,12 @@ class Sector(TimeStampedModel):
Represents a sector
"""
- name = models.CharField(max_length=45, unique=True)
- description = models.CharField(
- max_length=256,
- blank=True,
- null=True
- )
- alternate_id = models.IntegerField(
- blank=True,
- null=True
- )
- alternate_name = models.CharField(
- max_length=255,
- blank=True,
- null=True
- )
- dashboard = models.BooleanField(
- default=False
- )
- color = models.CharField(max_length=7, null=True, blank=True)
+ name = models.CharField(max_length=45, unique=True, verbose_name=_('Name'))
+ description = models.CharField(max_length=256, blank=True, null=True, verbose_name=_('Description'))
+ alternate_id = models.IntegerField(blank=True, null=True, verbose_name=_('Alternate ID'))
+ alternate_name = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Alternate Name'))
+ dashboard = models.BooleanField(default=False, verbose_name=_('Dashboard'))
+ color = models.CharField(max_length=7, null=True, blank=True, verbose_name=_('Color'))
class Meta:
ordering = ['name']
@@ -354,6 +341,7 @@ class LowerResult(TimeStampedModel):
result_link = models.ForeignKey(
'partners.InterventionResultLink',
related_name='ll_results',
+ verbose_name=_('Result Link')
)
name = models.CharField(verbose_name=_("Name"), max_length=500)
@@ -390,7 +378,7 @@ class Unit(models.Model):
"""
Represents an unit of measurement
"""
- type = models.CharField(max_length=45, unique=True)
+ type = models.CharField(max_length=45, unique=True, verbose_name=_('Type'))
class Meta:
ordering = ['type']
@@ -515,8 +503,8 @@ class Disaggregation(TimeStampedModel):
As an example, the Disaggregation could be , and it would have multiple "categories"
such as: <1, 1-5, 5-18, 18-64, 65+. Each of those categories would be a DisaggregationValue.
"""
- name = models.CharField(max_length=255, unique=True)
- active = models.BooleanField(default=False)
+ name = models.CharField(max_length=255, unique=True, verbose_name=_('Name'))
+ active = models.BooleanField(default=False, verbose_name=_('Active'))
def __str__(self):
return self.name
@@ -530,9 +518,10 @@ class DisaggregationValue(TimeStampedModel):
related models:
Disaggregation (ForeignKey): "disaggregation"
"""
- disaggregation = models.ForeignKey(Disaggregation, related_name="disaggregation_values")
- value = models.CharField(max_length=15)
- active = models.BooleanField(default=False)
+ disaggregation = models.ForeignKey(Disaggregation, related_name="disaggregation_values",
+ verbose_name=_('Disaggregation'))
+ value = models.CharField(max_length=15, verbose_name=_('Value'))
+ active = models.BooleanField(default=False, verbose_name=_('Active'))
def __str__(self):
return "Disaggregation Value {} -> {}".format(self.disaggregation, self.value)
diff --git a/EquiTrack/snapshot/migrations/0001_initial.py b/EquiTrack/snapshot/migrations/0001_initial.py
index 58ba3e172..0f0dd99c2 100644
--- a/EquiTrack/snapshot/migrations/0001_initial.py
+++ b/EquiTrack/snapshot/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-26 09:32
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.conf import settings
@@ -26,15 +26,16 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('target_object_id', models.CharField(db_index=True, max_length=255)),
+ ('target_object_id', models.CharField(db_index=True, max_length=255, verbose_name='Target Object ID')),
('action', models.CharField(choices=[('create', 'Create'), ('update', 'Update')], max_length=50, verbose_name='Action')),
('data', django.contrib.postgres.fields.jsonb.JSONField(verbose_name='Data')),
('change', django.contrib.postgres.fields.jsonb.JSONField(blank=True, verbose_name='Change')),
('by_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='By User')),
- ('target_content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activity', to='contenttypes.ContentType')),
+ ('target_content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activity', to='contenttypes.ContentType', verbose_name='Content Type')),
],
options={
'ordering': ['-created'],
+ 'verbose_name_plural': 'Activities',
},
),
]
diff --git a/EquiTrack/snapshot/migrations/0002_auto_20171030_1318.py b/EquiTrack/snapshot/migrations/0002_auto_20171030_1318.py
deleted file mode 100644
index 8fcf53813..000000000
--- a/EquiTrack/snapshot/migrations/0002_auto_20171030_1318.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-30 13:18
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('snapshot', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='activity',
- options={'ordering': ['-created'], 'verbose_name_plural': 'Activities'},
- ),
- ]
diff --git a/EquiTrack/snapshot/models.py b/EquiTrack/snapshot/models.py
index abe9d435e..003618611 100644
--- a/EquiTrack/snapshot/models.py
+++ b/EquiTrack/snapshot/models.py
@@ -25,9 +25,10 @@ class Activity(TimeStampedModel):
ContentType,
related_name='activity',
on_delete=models.CASCADE,
- db_index=True
+ db_index=True,
+ verbose_name=_('Content Type')
)
- target_object_id = models.CharField(max_length=255, db_index=True)
+ target_object_id = models.CharField(max_length=255, db_index=True, verbose_name=_('Target Object ID'))
target = GenericForeignKey('target_content_type', 'target_object_id')
action = models.CharField(
verbose_name=_("Action"),
diff --git a/EquiTrack/supplies/migrations/0001_initial.py b/EquiTrack/supplies/migrations/0001_initial.py
deleted file mode 100644
index 8e225294f..000000000
--- a/EquiTrack/supplies/migrations/0001_initial.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='SupplyItem',
- fields=[
- ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
- ('name', models.CharField(unique=True, max_length=255)),
- ('description', models.TextField(blank=True)),
- ],
- options={
- },
- bases=(models.Model,),
- ),
- ]
diff --git a/EquiTrack/supplies/migrations/0002_delete_supplyitem.py b/EquiTrack/supplies/migrations/0002_delete_supplyitem.py
deleted file mode 100644
index fbdc266d2..000000000
--- a/EquiTrack/supplies/migrations/0002_delete_supplyitem.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-29 19:33
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0052_auto_20170929_1933'),
- ('supplies', '0001_initial'),
- ]
-
- operations = [
- migrations.DeleteModel(
- name='SupplyItem',
- ),
- ]
diff --git a/EquiTrack/supplies/models.py b/EquiTrack/supplies/models.py
deleted file mode 100644
index e7251270a..000000000
--- a/EquiTrack/supplies/models.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Models removed so that migration can run to drop the associated tables. Once
-# that migration has been run on production, this entire app can be deleted and
-# removed from INSTALLED_APPS.
diff --git a/EquiTrack/t2f/migrations/0001_initial.py b/EquiTrack/t2f/migrations/0001_initial.py
index 41bb81be9..8668c2aab 100644
--- a/EquiTrack/t2f/migrations/0001_initial.py
+++ b/EquiTrack/t2f/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-02 21:53
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.conf import settings
@@ -15,12 +15,12 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ('publics', '0001_initial'),
- ('partners', '0017_remove_bankdetails_agreement'),
- ('locations', '0004_auto_20170112_2051'),
- ('users', '0004_auto_20170201_1731'),
+ ('users', '0001_initial'),
+ ('reports', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('reports', '0003_auto_20161227_1953'),
+ ('locations', '0001_initial'),
+ ('publics', '0001_initial'),
+ ('partners', '0001_initial'),
]
operations = [
@@ -28,72 +28,74 @@ class Migration(migrations.Migration):
name='ActionPoint',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('action_point_number', models.CharField(default=t2f.models.make_action_point_number, max_length=11, unique=True)),
- ('description', models.CharField(max_length=254)),
- ('due_date', models.DateTimeField()),
- ('status', models.CharField(choices=[('open', 'Open'), ('ongoing', 'Ongoing'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], max_length=254, null=True, verbose_name='Status')),
- ('completed_at', models.DateTimeField(blank=True, null=True)),
- ('actions_taken', models.TextField(blank=True, null=True)),
- ('follow_up', models.BooleanField(default=False)),
- ('comments', models.TextField(blank=True, null=True)),
- ('created_at', models.DateTimeField(auto_now_add=True)),
- ('assigned_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL)),
- ('person_responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL)),
+ ('action_point_number', models.CharField(default=t2f.models.make_action_point_number, max_length=11, unique=True, verbose_name='Action Point Number')),
+ ('description', models.CharField(max_length=254, verbose_name='Description')),
+ ('due_date', models.DateTimeField(verbose_name='Due Date')),
+ ('status', models.CharField(blank=True, choices=[('open', 'Open'), ('ongoing', 'Ongoing'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], max_length=254, null=True, verbose_name='Status')),
+ ('completed_at', models.DateTimeField(blank=True, null=True, verbose_name='Completed At')),
+ ('actions_taken', models.TextField(blank=True, null=True, verbose_name='Actions Taken')),
+ ('follow_up', models.BooleanField(default=False, verbose_name='Follow up')),
+ ('comments', models.TextField(blank=True, null=True, verbose_name='Comments')),
+ ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
+ ('assigned_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Assigned By')),
+ ('person_responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Responsible Person')),
],
),
migrations.CreateModel(
name='Clearances',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('medical_clearance', models.CharField(choices=[('requested', 'requested'), ('not_requested', 'not_requested'), ('not_applicable', 'not_applicable')], default='not_applicable', max_length=14)),
- ('security_clearance', models.CharField(choices=[('requested', 'requested'), ('not_requested', 'not_requested'), ('not_applicable', 'not_applicable')], default='not_applicable', max_length=14)),
- ('security_course', models.CharField(choices=[('requested', 'requested'), ('not_requested', 'not_requested'), ('not_applicable', 'not_applicable')], default='not_applicable', max_length=14)),
+ ('medical_clearance', models.CharField(choices=[('requested', 'requested'), ('not_requested', 'not_requested'), ('not_applicable', 'not_applicable')], default='not_applicable', max_length=14, verbose_name='Medical Clearance')),
+ ('security_clearance', models.CharField(choices=[('requested', 'requested'), ('not_requested', 'not_requested'), ('not_applicable', 'not_applicable')], default='not_applicable', max_length=14, verbose_name='Security Clearance')),
+ ('security_course', models.CharField(choices=[('requested', 'requested'), ('not_requested', 'not_requested'), ('not_applicable', 'not_applicable')], default='not_applicable', max_length=14, verbose_name='Security Course')),
],
+ options={
+ 'verbose_name_plural': 'Clearances',
+ },
),
migrations.CreateModel(
name='CostAssignment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('share', models.PositiveIntegerField()),
- ('delegate', models.BooleanField(default=False)),
- ('business_area', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.BusinessArea')),
- ('fund', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Fund')),
- ('grant', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Grant')),
+ ('share', models.PositiveIntegerField(verbose_name='Share')),
+ ('delegate', models.BooleanField(default=False, verbose_name='Delegate')),
+ ('business_area', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.BusinessArea', verbose_name='Business Area')),
+ ('fund', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Fund', verbose_name='Fund')),
+ ('grant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Grant', verbose_name='Grant')),
],
),
migrations.CreateModel(
name='Deduction',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('date', models.DateField()),
- ('breakfast', models.BooleanField(default=False)),
- ('lunch', models.BooleanField(default=False)),
- ('dinner', models.BooleanField(default=False)),
- ('accomodation', models.BooleanField(default=False)),
- ('no_dsa', models.BooleanField(default=False)),
+ ('date', models.DateField(verbose_name='Date')),
+ ('breakfast', models.BooleanField(default=False, verbose_name='Breakfast')),
+ ('lunch', models.BooleanField(default=False, verbose_name='Lunch')),
+ ('dinner', models.BooleanField(default=False, verbose_name='Dinner')),
+ ('accomodation', models.BooleanField(default=False, verbose_name='Accomodation')),
+ ('no_dsa', models.BooleanField(default=False, verbose_name='No DSA')),
],
),
migrations.CreateModel(
name='Expense',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('amount', models.DecimalField(decimal_places=4, max_digits=10)),
- ('account_currency', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency')),
- ('document_currency', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency')),
+ ('amount', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='Amount')),
+ ('currency', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency', verbose_name='Currency')),
],
),
migrations.CreateModel(
name='Invoice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('reference_number', models.CharField(max_length=32, unique=True)),
- ('business_area', models.CharField(max_length=32)),
- ('vendor_number', models.CharField(max_length=32)),
- ('amount', models.DecimalField(decimal_places=4, max_digits=20)),
- ('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('success', 'Success'), ('error', 'Error')], max_length=16)),
- ('message', models.TextField(blank=True, null=True)),
- ('vision_fi_id', models.CharField(blank=True, max_length=16, null=True)),
- ('currency', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency')),
+ ('reference_number', models.CharField(max_length=32, unique=True, verbose_name='Reference Number')),
+ ('business_area', models.CharField(max_length=32, verbose_name='Business Area')),
+ ('vendor_number', models.CharField(max_length=32, verbose_name='Vendor Number')),
+ ('amount', models.DecimalField(decimal_places=4, max_digits=20, verbose_name='Amount')),
+ ('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('success', 'Success'), ('error', 'Error')], max_length=16, verbose_name='Status')),
+ ('messages', django.contrib.postgres.fields.ArrayField(base_field=models.TextField(blank=True, null=True), default=[], size=None, verbose_name='Messages')),
+ ('vision_fi_id', models.CharField(blank=True, max_length=16, null=True, verbose_name='Vision FI ID')),
+ ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency', verbose_name='Currency')),
],
),
migrations.CreateModel(
@@ -101,148 +103,140 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.DecimalField(decimal_places=10, max_digits=20)),
- ('fund', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Fund')),
- ('grant', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Grant')),
- ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='t2f.Invoice')),
- ('wbs', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.WBS')),
+ ('fund', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Fund', verbose_name='Fund')),
+ ('grant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Grant', verbose_name='Grant')),
+ ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='t2f.Invoice', verbose_name='Invoice')),
+ ('wbs', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.WBS', verbose_name='')),
],
),
migrations.CreateModel(
- name='IteneraryItem',
+ name='ItineraryItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('origin', models.CharField(max_length=255)),
- ('destination', models.CharField(max_length=255)),
- ('departure_date', models.DateTimeField()),
- ('arrival_date', models.DateTimeField()),
- ('overnight_travel', models.BooleanField(default=False)),
- ('mode_of_travel', models.CharField(choices=[('Plane', 'Plane'), ('Bus', 'Bus'), ('Car', 'Car'), ('Boat', 'Boat'), ('Rail', 'Rail')], max_length=5, null=True)),
- ('airlines', models.ManyToManyField(related_name='_iteneraryitem_airlines_+', to='publics.AirlineCompany')),
- ('dsa_region', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.DSARegion')),
+ ('origin', models.CharField(max_length=255, verbose_name='Origin')),
+ ('destination', models.CharField(max_length=255, verbose_name='Destination')),
+ ('departure_date', models.DateTimeField(verbose_name='Departure Date')),
+ ('arrival_date', models.DateTimeField(verbose_name='Arrival Date')),
+ ('overnight_travel', models.BooleanField(default=False, verbose_name='Overnight Travel')),
+ ('mode_of_travel', models.CharField(blank=True, choices=[('Plane', 'Plane'), ('Bus', 'Bus'), ('Car', 'Car'), ('Boat', 'Boat'), ('Rail', 'Rail')], max_length=5, null=True, verbose_name='Mode of Travel')),
+ ('airlines', models.ManyToManyField(related_name='_itineraryitem_airlines_+', to='publics.AirlineCompany', verbose_name='Airlines')),
+ ('dsa_region', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.DSARegion', verbose_name='DSA Region')),
],
- options={
- 'ordering': ('id',),
- },
),
migrations.CreateModel(
name='Travel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
- ('completed_at', models.DateTimeField(null=True)),
- ('canceled_at', models.DateTimeField(null=True)),
- ('submitted_at', models.DateTimeField(null=True)),
- ('rejected_at', models.DateTimeField(null=True)),
- ('approved_at', models.DateTimeField(null=True)),
- ('rejection_note', models.TextField(null=True)),
- ('cancellation_note', models.TextField(null=True)),
- ('certification_note', models.TextField(null=True)),
- ('report_note', models.TextField(null=True)),
- ('misc_expenses', models.TextField(null=True)),
- ('status', django_fsm.FSMField(choices=[('planned', 'Planned'), ('submitted', 'Submitted'), ('rejected', 'Rejected'), ('approved', 'Approved'), ('completed', 'Completed'), ('cancelled', 'Cancelled'), ('sent_for_payment', 'Sent for payment'), ('certification_submitted', 'Certification submitted'), ('certification_approved', 'Certification approved'), ('certification_rejected', 'Certification rejected'), ('certified', 'Certified'), ('completed', 'Completed')], default='planned', max_length=50, protected=True)),
- ('start_date', models.DateTimeField(blank=True, null=True)),
- ('end_date', models.DateTimeField(blank=True, null=True)),
- ('purpose', models.CharField(blank=True, max_length=500, null=True)),
- ('additional_note', models.TextField(blank=True, null=True)),
- ('international_travel', models.NullBooleanField(default=False)),
- ('ta_required', models.NullBooleanField(default=True)),
- ('reference_number', models.CharField(default=t2f.models.make_travel_reference_number, max_length=12, unique=True)),
- ('hidden', models.BooleanField(default=False)),
- ('mode_of_travel', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('Plane', 'Plane'), ('Bus', 'Bus'), ('Car', 'Car'), ('Boat', 'Boat'), ('Rail', 'Rail')], max_length=5), null=True, size=None)),
- ('estimated_travel_cost', models.DecimalField(decimal_places=4, default=0, max_digits=20)),
- ('is_driver', models.BooleanField(default=False)),
- ('preserved_expenses', models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True)),
- ('approved_cost_traveler', models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True)),
- ('approved_cost_travel_agencies', models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True)),
- ('currency', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency')),
- ('office', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='users.Office')),
- ('section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='users.Section')),
- ('supervisor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL)),
- ('traveler', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='travels', to=settings.AUTH_USER_MODEL)),
+ ('created', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Created')),
+ ('completed_at', models.DateTimeField(blank=True, null=True, verbose_name='Completed At')),
+ ('canceled_at', models.DateTimeField(blank=True, null=True, verbose_name='Canceled At')),
+ ('submitted_at', models.DateTimeField(blank=True, null=True, verbose_name='Submitted At')),
+ ('first_submission_date', models.DateTimeField(blank=True, null=True, verbose_name='First Submission Date')),
+ ('rejected_at', models.DateTimeField(blank=True, null=True, verbose_name='Rejected At')),
+ ('approved_at', models.DateTimeField(blank=True, null=True, verbose_name='Approved At')),
+ ('rejection_note', models.TextField(blank=True, null=True, verbose_name='Rejection Note')),
+ ('cancellation_note', models.TextField(blank=True, null=True, verbose_name='Cancellation Note')),
+ ('certification_note', models.TextField(blank=True, null=True, verbose_name='Certification Note')),
+ ('report_note', models.TextField(blank=True, null=True, verbose_name='Report Note')),
+ ('misc_expenses', models.TextField(blank=True, null=True, verbose_name='Misc Expenses')),
+ ('status', django_fsm.FSMField(choices=[('planned', 'Planned'), ('submitted', 'Submitted'), ('rejected', 'Rejected'), ('approved', 'Approved'), ('completed', 'Completed'), ('cancelled', 'Cancelled'), ('sent_for_payment', 'Sent for payment'), ('certification_submitted', 'Certification submitted'), ('certification_approved', 'Certification approved'), ('certification_rejected', 'Certification rejected'), ('certified', 'Certified'), ('completed', 'Completed')], default='planned', max_length=50, protected=True, verbose_name='Status')),
+ ('start_date', models.DateTimeField(blank=True, null=True, verbose_name='Start Date')),
+ ('end_date', models.DateTimeField(blank=True, null=True, verbose_name='End Date')),
+ ('purpose', models.CharField(blank=True, max_length=500, null=True, verbose_name='Purpose')),
+ ('additional_note', models.TextField(blank=True, null=True, verbose_name='Additional Note')),
+ ('international_travel', models.NullBooleanField(default=False, verbose_name='International Travel')),
+ ('ta_required', models.NullBooleanField(default=True, verbose_name='TA Required')),
+ ('reference_number', models.CharField(default=t2f.models.make_travel_reference_number, max_length=12, unique=True, verbose_name='Reference Number')),
+ ('hidden', models.BooleanField(default=False, verbose_name='Hidden')),
+ ('mode_of_travel', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('Plane', 'Plane'), ('Bus', 'Bus'), ('Car', 'Car'), ('Boat', 'Boat'), ('Rail', 'Rail')], max_length=5), blank=True, null=True, size=None, verbose_name='Mode of Travel')),
+ ('estimated_travel_cost', models.DecimalField(decimal_places=4, default=0, max_digits=20, verbose_name='Estimated Travel Cost')),
+ ('is_driver', models.BooleanField(default=False, verbose_name='Is Driver')),
+ ('preserved_expenses_local', models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True, verbose_name='Preserved Expenses (Local)')),
+ ('preserved_expenses_usd', models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True, verbose_name='Preserved Expenses (USD)')),
+ ('approved_cost_traveler', models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True, verbose_name='Approved Cost Traveler')),
+ ('approved_cost_travel_agencies', models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True, verbose_name='Approved Cost Travel Agencies')),
+ ('currency', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency', verbose_name='Currency')),
+ ('office', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='users.Office', verbose_name='Office')),
+ ('section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='users.Section', verbose_name='Section')),
+ ('sector', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='reports.Sector', verbose_name='Sector')),
+ ('supervisor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Supervisor')),
+ ('traveler', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='travels', to=settings.AUTH_USER_MODEL, verbose_name='Travellert')),
],
),
migrations.CreateModel(
name='TravelActivity',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('travel_type', models.CharField(choices=[('Programmatic Visit', 'Programmatic Visit'), ('Spot Check', 'Spot Check'), ('Advocacy', 'Advocacy'), ('Technical Support', 'Technical Support'), ('Meeting', 'Meeting'), ('Staff Development', 'Staff Development'), ('Staff Entitlement', 'Staff Entitlement')], max_length=64, null=True)),
- ('date', models.DateTimeField(null=True)),
- ('locations', models.ManyToManyField(related_name='_travelactivity_locations_+', to='locations.Location')),
- ('partner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='partners.PartnerOrganization')),
- ('partnership', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='partners.Intervention')),
- ('primary_traveler', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
- ('result', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='reports.Result')),
- ('travels', models.ManyToManyField(related_name='activities', to='t2f.Travel')),
+ ('travel_type', models.CharField(blank=True, choices=[('Programmatic Visit', 'Programmatic Visit'), ('Spot Check', 'Spot Check'), ('Advocacy', 'Advocacy'), ('Technical Support', 'Technical Support'), ('Meeting', 'Meeting'), ('Staff Development', 'Staff Development'), ('Staff Entitlement', 'Staff Entitlement')], max_length=64, null=True, verbose_name='Travel Type')),
+ ('date', models.DateTimeField(blank=True, null=True, verbose_name='Date')),
+ ('locations', models.ManyToManyField(related_name='_travelactivity_locations_+', to='locations.Location', verbose_name='Locations')),
+ ('partner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='partners.PartnerOrganization', verbose_name='Partner')),
+ ('partnership', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='travel_activities', to='partners.Intervention', verbose_name='Partnership')),
+ ('primary_traveler', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Primary Traveler')),
+ ('result', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='reports.Result', verbose_name='Result')),
+ ('travels', models.ManyToManyField(related_name='activities', to='t2f.Travel', verbose_name='Travels')),
],
+ options={
+ 'verbose_name_plural': 'Travel Activities',
+ },
),
migrations.CreateModel(
name='TravelAttachment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('type', models.CharField(max_length=64)),
- ('name', models.CharField(max_length=255)),
- ('file', models.FileField(upload_to=t2f.models.determine_file_upload_path)),
- ('travel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='t2f.Travel')),
- ],
- ),
- migrations.CreateModel(
- name='TravelPermission',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=128)),
- ('code', models.CharField(max_length=128)),
- ('status', models.CharField(max_length=50)),
- ('usage_place', models.CharField(choices=[('travel', 'Travel'), ('action_point', 'Action point')], max_length=12)),
- ('user_type', models.CharField(max_length=25)),
- ('model', models.CharField(max_length=128)),
- ('field', models.CharField(max_length=64)),
- ('permission_type', models.CharField(choices=[('edit', 'Edit'), ('view', 'View')], max_length=5)),
- ('value', models.BooleanField(default=False)),
+ ('type', models.CharField(max_length=64, verbose_name='Type')),
+ ('name', models.CharField(max_length=255, verbose_name='Name')),
+ ('file', models.FileField(max_length=255, upload_to=t2f.models.determine_file_upload_path, verbose_name='File')),
+ ('travel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='t2f.Travel', verbose_name='Travel')),
],
),
migrations.AddField(
- model_name='iteneraryitem',
+ model_name='itineraryitem',
name='travel',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='itinerary', to='t2f.Travel'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='itinerary', to='t2f.Travel', verbose_name='Travel'),
),
migrations.AddField(
model_name='invoice',
name='travel',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to='t2f.Travel'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invoices', to='t2f.Travel', verbose_name='Travel'),
),
migrations.AddField(
model_name='expense',
name='travel',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='t2f.Travel'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='t2f.Travel', verbose_name='Travel'),
),
migrations.AddField(
model_name='expense',
name='type',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.TravelExpenseType'),
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.TravelExpenseType', verbose_name='Type'),
),
migrations.AddField(
model_name='deduction',
name='travel',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='deductions', to='t2f.Travel'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='deductions', to='t2f.Travel', verbose_name='Deduction'),
),
migrations.AddField(
model_name='costassignment',
name='travel',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cost_assignments', to='t2f.Travel'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cost_assignments', to='t2f.Travel', verbose_name='Travel'),
),
migrations.AddField(
model_name='costassignment',
name='wbs',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.WBS'),
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.WBS', verbose_name='WBS'),
),
migrations.AddField(
model_name='clearances',
name='travel',
- field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='clearances', to='t2f.Travel'),
+ field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='clearances', to='t2f.Travel', verbose_name='Travel'),
),
migrations.AddField(
model_name='actionpoint',
name='travel',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_points', to='t2f.Travel'),
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_points', to='t2f.Travel', verbose_name='Travel'),
+ ),
+ migrations.AlterOrderWithRespectTo(
+ name='itineraryitem',
+ order_with_respect_to='travel',
),
]
diff --git a/EquiTrack/t2f/migrations/0002_auto_20170221_1634.py b/EquiTrack/t2f/migrations/0002_auto_20170221_1634.py
deleted file mode 100644
index 6afdd12a2..000000000
--- a/EquiTrack/t2f/migrations/0002_auto_20170221_1634.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-21 14:34
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0001_initial'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='expense',
- name='amount',
- field=models.DecimalField(decimal_places=4, max_digits=10, null=True),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0003_auto_20170228_0205.py b/EquiTrack/t2f/migrations/0003_auto_20170228_0205.py
deleted file mode 100644
index 6426baaff..000000000
--- a/EquiTrack/t2f/migrations/0003_auto_20170228_0205.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 00:05
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0002_auto_20170221_1634'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='costassignment',
- name='fund',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Fund'),
- ),
- migrations.AlterField(
- model_name='costassignment',
- name='grant',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Grant'),
- ),
- migrations.AlterField(
- model_name='costassignment',
- name='wbs',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.WBS'),
- ),
- migrations.AlterField(
- model_name='invoiceitem',
- name='fund',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Fund'),
- ),
- migrations.AlterField(
- model_name='invoiceitem',
- name='grant',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Grant'),
- ),
- migrations.AlterField(
- model_name='invoiceitem',
- name='wbs',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.WBS'),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0004_auto_20170228_0205.py b/EquiTrack/t2f/migrations/0004_auto_20170228_0205.py
deleted file mode 100644
index 37d62e2d4..000000000
--- a/EquiTrack/t2f/migrations/0004_auto_20170228_0205.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 00:05
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def null_wbs_grant_fund_related_fields(apps, schema_editor):
- CostAssignment = apps.get_model('t2f', 'CostAssignment')
- Invoice = apps.get_model('t2f', 'Invoice')
- InvoiceItem = apps.get_model('t2f', 'InvoiceItem')
-
- CostAssignment.objects.all().delete()
- InvoiceItem.objects.all().delete()
- Invoice.objects.all().delete()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0003_auto_20170228_0205'),
- ]
-
- operations = [
- migrations.RunPython(null_wbs_grant_fund_related_fields),
- ]
diff --git a/EquiTrack/t2f/migrations/0005_auto_20170228_1748.py b/EquiTrack/t2f/migrations/0005_auto_20170228_1748.py
deleted file mode 100644
index 50d581abf..000000000
--- a/EquiTrack/t2f/migrations/0005_auto_20170228_1748.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-28 15:48
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0004_auto_20170228_0205'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='invoice',
- name='message',
- ),
- migrations.AddField(
- model_name='invoice',
- name='messages',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.TextField(blank=True, null=True), default=[], size=None),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0006_auto_20170305_0530.py b/EquiTrack/t2f/migrations/0006_auto_20170305_0530.py
deleted file mode 100644
index 81340f516..000000000
--- a/EquiTrack/t2f/migrations/0006_auto_20170305_0530.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-05 03:30
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import t2f.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0005_auto_20170228_1748'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='travelattachment',
- name='file',
- field=models.FileField(max_length=255, upload_to=t2f.models.determine_file_upload_path),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0007_travelactivity_government_partnership.py b/EquiTrack/t2f/migrations/0007_travelactivity_government_partnership.py
deleted file mode 100644
index f6593eda7..000000000
--- a/EquiTrack/t2f/migrations/0007_travelactivity_government_partnership.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-08 10:51
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('partners', '0023_auto_20170301_2324'),
- ('t2f', '0006_auto_20170305_0530'),
- ]
-
- operations = [
- ]
diff --git a/EquiTrack/t2f/migrations/0008_auto_20170323_1111.py b/EquiTrack/t2f/migrations/0008_auto_20170323_1111.py
deleted file mode 100644
index c82cab235..000000000
--- a/EquiTrack/t2f/migrations/0008_auto_20170323_1111.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-23 09:11
-from __future__ import unicode_literals
-import datetime
-
-from django.db import migrations
-from django.utils import timezone
-
-
-def set_clearances_for_old_trips(apps, schema_editor):
- """ Migration of old trips failed to create related
- Clearances (which default to not_applicable),
- so old trips can't be completed.
-
- https://github.com/unicef/etools-issues/issues/166
- """
-
- Travel = apps.get_model("t2f", "Travel")
- Clearances = apps.get_model("t2f", "Clearances")
-
- six_months_ago = timezone.now() - datetime.timedelta(days=180)
- for travel in Travel.objects.filter(created__lt=six_months_ago):
- clearances = Clearances(travel=travel)
- clearances.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0007_travelactivity_government_partnership'),
- ]
-
- operations = [
- migrations.RunPython(set_clearances_for_old_trips),
- ]
diff --git a/EquiTrack/t2f/migrations/0009_auto_20170324_1121.py b/EquiTrack/t2f/migrations/0009_auto_20170324_1121.py
deleted file mode 100644
index c9ab324b9..000000000
--- a/EquiTrack/t2f/migrations/0009_auto_20170324_1121.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-24 09:21
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-def order_iteneraryitems(apps, schema_editor):
- IteneraryItem = apps.get_model("t2f", "IteneraryItem")
- Travel = apps.get_model("t2f", "Travel")
-
- for travel in Travel.objects.all():
- iteneraryitems = travel.itinerary.all().order_by('departure_date')
- if len(iteneraryitems) > 1:
- travel.set_iteneraryitem_order([i.pk for i in iteneraryitems])
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0008_auto_20170323_1111'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='iteneraryitem',
- options={},
- ),
- migrations.AlterOrderWithRespectTo(
- name='iteneraryitem',
- order_with_respect_to='travel',
- ),
- migrations.RunPython(order_iteneraryitems),
- ]
diff --git a/EquiTrack/t2f/migrations/0010_fix_clearances.py b/EquiTrack/t2f/migrations/0010_fix_clearances.py
deleted file mode 100644
index b693f100c..000000000
--- a/EquiTrack/t2f/migrations/0010_fix_clearances.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-23 09:11
-from __future__ import unicode_literals
-import datetime
-
-from django.db import migrations
-from django.utils import timezone
-
-
-def set_clearances_for_old_trips(apps, schema_editor):
- """ Migration of old trips failed to create related
- Clearances (which default to not_applicable),
- so old trips can't be completed.
-
- https://github.com/unicef/etools-issues/issues/166
- """
-
- Travel = apps.get_model("t2f", "Travel")
- Clearances = apps.get_model("t2f", "Clearances")
-
- six_months_ago = timezone.now() - datetime.timedelta(days=180)
- for travel in Travel.objects.filter(created__gt=six_months_ago):
- if not hasattr(travel, 'clearances'):
- # creating Clearances
- clearances = Clearances(travel=travel)
- clearances.save()
- else:
- pass
-
-
-def reverse(apps, schema_editor):
- pass
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0009_auto_20170324_1121'),
- ]
-
- operations = [
- migrations.RunPython(set_clearances_for_old_trips, reverse),
- ]
diff --git a/EquiTrack/t2f/migrations/0011_travel_first_submission_date.py b/EquiTrack/t2f/migrations/0011_travel_first_submission_date.py
deleted file mode 100644
index 1f8f06f2a..000000000
--- a/EquiTrack/t2f/migrations/0011_travel_first_submission_date.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-26 12:34
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0010_fix_clearances'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='travel',
- name='first_submission_date',
- field=models.DateTimeField(null=True),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0012_auto_20170427_1447.py b/EquiTrack/t2f/migrations/0012_auto_20170427_1447.py
deleted file mode 100644
index acb28da16..000000000
--- a/EquiTrack/t2f/migrations/0012_auto_20170427_1447.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-27 14:47
-from __future__ import unicode_literals
-
-from django.db import migrations
-from django.utils.timezone import now
-
-
-def set_first_submission_date(apps, schema_editor):
- Travel = apps.get_model('t2f', 'Travel')
-
- Travel.objects.all().update(first_submission_date=now())
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0011_travel_first_submission_date'),
- ('publics', '0018_auto_20170426_1656'),
- ]
-
- operations = [
- migrations.RunPython(set_first_submission_date),
- ]
diff --git a/EquiTrack/t2f/migrations/0013_auto_20170427_1730.py b/EquiTrack/t2f/migrations/0013_auto_20170427_1730.py
deleted file mode 100644
index 66705e8fe..000000000
--- a/EquiTrack/t2f/migrations/0013_auto_20170427_1730.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-04-27 17:30
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0012_auto_20170427_1447'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='expense',
- old_name='account_currency',
- new_name='currency',
- ),
- migrations.RenameField(
- model_name='travel',
- old_name='preserved_expenses',
- new_name='preserved_expenses_local',
- ),
- migrations.RemoveField(
- model_name='expense',
- name='document_currency',
- ),
- migrations.AddField(
- model_name='travel',
- name='preserved_expenses_usd',
- field=models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0014_auto_20170522_1356.py b/EquiTrack/t2f/migrations/0014_auto_20170522_1356.py
deleted file mode 100644
index 4b9c7738e..000000000
--- a/EquiTrack/t2f/migrations/0014_auto_20170522_1356.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-22 13:56
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def fix_empty_invoice_currencies(apps, schema_editor):
- Invoice = apps.get_model('t2f', 'Invoice')
-
- for invoice in Invoice.objects.filter(currency__isnull=True):
- invoice.currency = invoice.travel.currency
- invoice.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0013_auto_20170427_1730'),
- ]
-
- operations = [
- migrations.RunPython(fix_empty_invoice_currencies),
- ]
diff --git a/EquiTrack/t2f/migrations/0015_auto_20170524_1651.py b/EquiTrack/t2f/migrations/0015_auto_20170524_1651.py
deleted file mode 100644
index 9e741edd7..000000000
--- a/EquiTrack/t2f/migrations/0015_auto_20170524_1651.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-24 16:51
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0014_auto_20170522_1356'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='invoice',
- name='currency',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency'),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0016_delete_travelpermission.py b/EquiTrack/t2f/migrations/0016_delete_travelpermission.py
deleted file mode 100644
index b0083668b..000000000
--- a/EquiTrack/t2f/migrations/0016_delete_travelpermission.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-05-25 10:54
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0015_auto_20170524_1651'),
- ]
-
- operations = [
- migrations.DeleteModel(
- name='TravelPermission',
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0017_remove_travelactivity_government_partnership.py b/EquiTrack/t2f/migrations/0017_remove_travelactivity_government_partnership.py
deleted file mode 100644
index b299f53e7..000000000
--- a/EquiTrack/t2f/migrations/0017_remove_travelactivity_government_partnership.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-08 08:17
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0016_delete_travelpermission'),
- ]
-
- operations = [
- ]
diff --git a/EquiTrack/t2f/migrations/0018_auto_20170719_1529.py b/EquiTrack/t2f/migrations/0018_auto_20170719_1529.py
deleted file mode 100644
index 86410e7e0..000000000
--- a/EquiTrack/t2f/migrations/0018_auto_20170719_1529.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-07-19 15:29
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0017_remove_travelactivity_government_partnership'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='travelactivity',
- name='partnership',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='travel_activities', to='partners.Intervention'),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0019_rename_itenerary_item.py b/EquiTrack/t2f/migrations/0019_rename_itenerary_item.py
deleted file mode 100644
index f011d4aa8..000000000
--- a/EquiTrack/t2f/migrations/0019_rename_itenerary_item.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-08-28 15:09
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0018_auto_20170719_1529'),
- ]
-
- operations = [
- migrations.RenameModel("IteneraryItem", "ItineraryItem")
- ]
diff --git a/EquiTrack/t2f/migrations/0020_travel_sector.py b/EquiTrack/t2f/migrations/0020_travel_sector.py
deleted file mode 100644
index 15c321a66..000000000
--- a/EquiTrack/t2f/migrations/0020_travel_sector.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-23 19:28
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('reports', '0013_auto_20170829_1727'),
- ('t2f', '0019_rename_itenerary_item'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='travel',
- name='sector',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='reports.Sector'),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0021_auto_20171023_2121.py b/EquiTrack/t2f/migrations/0021_auto_20171023_2121.py
deleted file mode 100644
index feb7ea0f4..000000000
--- a/EquiTrack/t2f/migrations/0021_auto_20171023_2121.py
+++ /dev/null
@@ -1,186 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-10-23 21:21
-from __future__ import unicode_literals
-
-import logging
-
-from django.db import connection, migrations
-
-logger = logging.getLogger(__name__)
-
-
-def sections_to_sectors(apps, schema_editor):
-
- MAPPER = {
- 'Cambodia': {
- 'Child Survival and Development': 'Child Survival & Development',
- },
- 'Indonesia': {
- 'Child Survival and Development': 'Child Survival & Development (CSD)',
- },
- 'Kyrgyzstan': {
- 'Education': 'Education & ECD',
- 'ADAP': 'Youth and Adolescent Development',
- 'WASH': 'WASH & DRR',
- },
- 'Rwanda': {
- 'PME': 'Planning, Monitoring and Evaluation',
- 'CSD': 'Child Survival and Development',
- 'CAP': 'Communication, Advocacy and Partnerships',
- 'Partnerships': 'Communication, Advocacy and Partnerships',
- },
- 'Kenya': {
- 'Emergency and Field Operations': 'Emergency & Field Operations',
- 'PME': 'Planning, Monitoring & Evaluation',
- 'Social Policy and Protection': 'Social Policy',
- 'HIV/AIDS': 'HIV and AIDS',
- 'C4D': 'Communication for Development (C4D)',
- "Rep's Office": 'Front Office',
- 'Advocacy and Partnerships': 'Advocacy & Partnerships',
- 'Basic Education': 'Education',
- },
- 'Ethiopia': {
- 'PME': 'PMU',
- },
- 'Libya': {
- 'PRIME': 'PME',
- 'Basic Education': 'Education',
- },
- 'Liberia': {
- 'Basic Education': 'Education',
- },
- 'Lebanon': {
- 'Coordination': 'Humanitarian Coordination',
- 'Policy and Advocacy': 'Social Protection',
- 'Youth': 'Child Protection',
- 'Winterization': 'Winter',
- 'NFI and Supply': 'Operations',
- 'ICT': 'Operations'
- },
- 'South Africa': {
- 'Health': 'Health and Nutrition',
- 'Child Protection': 'Child Protection & Social Policy',
- 'Education': 'Basic Education & Adolescent Development',
- 'Basic Education': 'Basic Education & Adolescent Development',
- },
- 'Jordan': {
- 'Health and Nutrition': 'Health & Nutrition',
- },
- 'Iraq': {
- 'Planning Monitoring and Evaluation': 'Planning, Monitoring & Evaluation (PME)',
- 'Field Operations': 'Field Operations & RRM',
- 'Child Protection': 'Child Protection & Adolescent Development',
- 'Basic Education': 'Education',
- 'Field Operations and RRM': 'Field Operations & RRM',
- "Deputy Rep.Office": 'Deputy Rep Office',
- "Deputy Rep. Office": 'Deputy Rep Office',
- },
- 'Syria': {
- 'Field Coordination': 'Field Operations',
- 'ICT': 'Operations',
- 'Education Sector': 'Education',
- 'PME': 'M&E',
- 'Child Protection': 'Social Policy & Child Protection',
- "Regional Director's Office": 'Planning & HACT',
- 'Child Survival': 'Health and Nutrition',
- 'Deputy Rep.Office': 'Deputy Rep. Office',
- 'C4D': 'Communication for Development',
- 'Emergency': 'Field Operations',
- 'Basic Education': 'Education',
- 'PRIME': 'M&E',
-
- },
- 'Sudan': {
- 'PME': 'Planning Monitoring and Evaluation',
- },
- 'Afghanistan': {
- 'Risk Assurance': 'Operations',
- 'Finance': 'Operations',
- 'PRIME': 'SPPME',
- 'Resource Mobilization & Budget Unit': 'Programme Coordination',
- 'ICT': 'Operations',
- 'Deputy Rep. Office': 'Deputy Representative’s Office',
- 'Deputy Rep Office': 'Deputy Representative’s Office',
- 'CFO': 'Communication Advocacy& Civic Engagement[CACE]'
- },
- 'Nepal': {
- 'CFO': 'C4D',
- },
- 'Sierra Leone': {
- 'HivAids': 'CSD - HIV/AIDS',
- 'PRIME': 'SPPM&E',
- "Rep's Office": "Representative's Office",
- "Regional Director's Office": "Deputy Representative's Office",
- "Chief of Operations Office": "Operations",
- 'Nutrition': 'CSD - Nutrition',
- 'HIV/AIDS': 'CSD - HIV/AIDS',
- 'Health': 'CSD - Health',
- 'WASH': 'CSD - WASH',
- 'Supply and Procurement': 'Supply & Procurement',
- 'PME': 'SPPM&E',
- },
- 'Senegal': {
- 'Child Survival and Development': 'Child Survival & Development',
- 'Social Policy': 'Social Policy & Advocacy',
- },
- 'Burkina Faso': {
- 'Nutrition': 'Health & Nutrition',
- 'SPPM&E': 'SPPME',
- 'Health': 'Health & Nutrition',
- 'Communications and Advocacy': 'Communication and Advocacy'
- },
- 'Nigeria': {
- "Regional Director's Office": 'Deputy Reps Office',
- "Rep's Office": 'Representative Office',
- },
- 'Guinea': {
- 'Child Survival and Development': 'Child Survival & Development',
- },
- }
-
- Travel = apps.get_model('t2f', 'Travel')
- Sector = apps.get_model('reports', 'Sector')
- Workspace = apps.get_model('users', 'Country')
- tenant = Workspace.objects.get(schema_name=connection.schema_name)
- country_mapper = MAPPER.get(tenant.name, {})
- total = Travel.objects.count()
-
- found = not_found = 0
- missing = []
- for travel in Travel.objects.all():
- if travel.section:
- if travel.section.name in country_mapper and Sector.objects.filter(
- name=country_mapper[travel.section.name]).exists():
- related_sector = Sector.objects.get(name=country_mapper[travel.section.name])
-
- elif Sector.objects.filter(name=travel.section.name).exists():
- related_sector = Sector.objects.get(name=travel.section.name)
- else:
- related_sector = None
- not_found += 1
- if travel.section.name not in missing:
- missing.append(travel.section.name)
-
- if related_sector:
- found += 1
- travel.sector = related_sector
- travel.save()
- report_line = '{}: Total: {} Found: {} - Not Found: {} {}'.format(
- connection.schema_name, total, found, not_found, missing)
- logging.info(report_line)
-
-
-def clean_sectors(apps, schema_editor):
- Travel = apps.get_model('t2f', 'Travel')
- Travel.objects.all().update(sector=None)
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0020_travel_sector'),
- ]
-
- operations = [
- migrations.RunPython(sections_to_sectors, clean_sectors),
- ]
diff --git a/EquiTrack/t2f/migrations/0022_auto_20171121_1627.py b/EquiTrack/t2f/migrations/0022_auto_20171121_1627.py
deleted file mode 100644
index 511e34180..000000000
--- a/EquiTrack/t2f/migrations/0022_auto_20171121_1627.py
+++ /dev/null
@@ -1,192 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-21 16:27
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0021_auto_20171023_2121'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='actionpoint',
- name='status',
- field=models.CharField(blank=True, choices=[('open', 'Open'), ('ongoing', 'Ongoing'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], max_length=254, null=True, verbose_name='Status'),
- ),
- migrations.AlterField(
- model_name='costassignment',
- name='business_area',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.BusinessArea'),
- ),
- migrations.AlterField(
- model_name='costassignment',
- name='fund',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Fund'),
- ),
- migrations.AlterField(
- model_name='costassignment',
- name='grant',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Grant'),
- ),
- migrations.AlterField(
- model_name='costassignment',
- name='wbs',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.WBS'),
- ),
- migrations.AlterField(
- model_name='expense',
- name='amount',
- field=models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True),
- ),
- migrations.AlterField(
- model_name='expense',
- name='currency',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency'),
- ),
- migrations.AlterField(
- model_name='expense',
- name='type',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.TravelExpenseType'),
- ),
- migrations.AlterField(
- model_name='invoiceitem',
- name='fund',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Fund'),
- ),
- migrations.AlterField(
- model_name='invoiceitem',
- name='grant',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.Grant'),
- ),
- migrations.AlterField(
- model_name='invoiceitem',
- name='wbs',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='publics.WBS'),
- ),
- migrations.AlterField(
- model_name='itineraryitem',
- name='dsa_region',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.DSARegion'),
- ),
- migrations.AlterField(
- model_name='itineraryitem',
- name='mode_of_travel',
- field=models.CharField(blank=True, choices=[('Plane', 'Plane'), ('Bus', 'Bus'), ('Car', 'Car'), ('Boat', 'Boat'), ('Rail', 'Rail')], max_length=5, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='approved_at',
- field=models.DateTimeField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='approved_cost_travel_agencies',
- field=models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='approved_cost_traveler',
- field=models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='canceled_at',
- field=models.DateTimeField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='cancellation_note',
- field=models.TextField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='certification_note',
- field=models.TextField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='completed_at',
- field=models.DateTimeField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='currency',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='publics.Currency'),
- ),
- migrations.AlterField(
- model_name='travel',
- name='first_submission_date',
- field=models.DateTimeField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='misc_expenses',
- field=models.TextField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='mode_of_travel',
- field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('Plane', 'Plane'), ('Bus', 'Bus'), ('Car', 'Car'), ('Boat', 'Boat'), ('Rail', 'Rail')], max_length=5), blank=True, null=True, size=None),
- ),
- migrations.AlterField(
- model_name='travel',
- name='preserved_expenses_local',
- field=models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='preserved_expenses_usd',
- field=models.DecimalField(blank=True, decimal_places=4, default=None, max_digits=20, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='rejected_at',
- field=models.DateTimeField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='rejection_note',
- field=models.TextField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='report_note',
- field=models.TextField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travel',
- name='submitted_at',
- field=models.DateTimeField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travelactivity',
- name='date',
- field=models.DateTimeField(blank=True, null=True),
- ),
- migrations.AlterField(
- model_name='travelactivity',
- name='partner',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='partners.PartnerOrganization'),
- ),
- migrations.AlterField(
- model_name='travelactivity',
- name='partnership',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='travel_activities', to='partners.Intervention'),
- ),
- migrations.AlterField(
- model_name='travelactivity',
- name='result',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='reports.Result'),
- ),
- migrations.AlterField(
- model_name='travelactivity',
- name='travel_type',
- field=models.CharField(blank=True, choices=[('Programmatic Visit', 'Programmatic Visit'), ('Spot Check', 'Spot Check'), ('Advocacy', 'Advocacy'), ('Technical Support', 'Technical Support'), ('Meeting', 'Meeting'), ('Staff Development', 'Staff Development'), ('Staff Entitlement', 'Staff Entitlement')], max_length=64, null=True),
- ),
- ]
diff --git a/EquiTrack/t2f/migrations/0023_auto_20180309_1210.py b/EquiTrack/t2f/migrations/0023_auto_20180309_1210.py
deleted file mode 100644
index 9e4110a95..000000000
--- a/EquiTrack/t2f/migrations/0023_auto_20180309_1210.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-09 12:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('t2f', '0022_auto_20171121_1627'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='clearances',
- options={'verbose_name_plural': 'Clearances'},
- ),
- migrations.AlterModelOptions(
- name='travelactivity',
- options={'verbose_name_plural': 'Travel Activities'},
- ),
- ]
diff --git a/EquiTrack/t2f/models.py b/EquiTrack/t2f/models.py
index d57f20ee0..5324fb62e 100644
--- a/EquiTrack/t2f/models.py
+++ b/EquiTrack/t2f/models.py
@@ -141,46 +141,56 @@ class Travel(models.Model):
(COMPLETED, ugettext_lazy('Completed')),
)
- created = models.DateTimeField(auto_now_add=True, db_index=True)
- completed_at = models.DateTimeField(null=True, blank=True)
- canceled_at = models.DateTimeField(null=True, blank=True)
- submitted_at = models.DateTimeField(null=True, blank=True)
+ created = models.DateTimeField(auto_now_add=True, db_index=True, verbose_name=_('Created'))
+ completed_at = models.DateTimeField(null=True, blank=True, verbose_name=_('Completed At'))
+ canceled_at = models.DateTimeField(null=True, blank=True, verbose_name=_('Canceled At'))
+ submitted_at = models.DateTimeField(null=True, blank=True, verbose_name=_('Submitted At'))
# Required to calculate with proper dsa values
- first_submission_date = models.DateTimeField(null=True, blank=True)
- rejected_at = models.DateTimeField(null=True, blank=True)
- approved_at = models.DateTimeField(null=True, blank=True)
-
- rejection_note = models.TextField(null=True, blank=True)
- cancellation_note = models.TextField(null=True, blank=True)
- certification_note = models.TextField(null=True, blank=True)
- report_note = models.TextField(null=True, blank=True)
- misc_expenses = models.TextField(null=True, blank=True)
-
- status = FSMField(default=PLANNED, choices=CHOICES, protected=True)
- traveler = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, related_name='travels')
- supervisor = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, related_name='+')
- office = models.ForeignKey('users.Office', null=True, blank=True, related_name='+')
- section = models.ForeignKey('users.Section', null=True, blank=True, related_name='+')
- sector = models.ForeignKey('reports.Sector', null=True, blank=True, related_name='+')
- start_date = models.DateTimeField(null=True, blank=True)
- end_date = models.DateTimeField(null=True, blank=True)
- purpose = models.CharField(max_length=500, null=True, blank=True)
- additional_note = models.TextField(null=True, blank=True)
- international_travel = models.NullBooleanField(default=False, null=True, blank=True)
- ta_required = models.NullBooleanField(default=True, null=True, blank=True)
- reference_number = models.CharField(max_length=12, default=make_travel_reference_number, unique=True)
- hidden = models.BooleanField(default=False)
- mode_of_travel = ArrayField(models.CharField(max_length=5, choices=ModeOfTravel.CHOICES), null=True, blank=True)
- estimated_travel_cost = models.DecimalField(max_digits=20, decimal_places=4, default=0)
- currency = models.ForeignKey('publics.Currency', related_name='+', null=True, blank=True)
- is_driver = models.BooleanField(default=False)
+ first_submission_date = models.DateTimeField(null=True, blank=True, verbose_name=_('First Submission Date'))
+ rejected_at = models.DateTimeField(null=True, blank=True, verbose_name=_('Rejected At'))
+ approved_at = models.DateTimeField(null=True, blank=True, verbose_name=_('Approved At'))
+
+ rejection_note = models.TextField(null=True, blank=True, verbose_name=_('Rejection Note'))
+ cancellation_note = models.TextField(null=True, blank=True, verbose_name=_('Cancellation Note'))
+ certification_note = models.TextField(null=True, blank=True, verbose_name=_('Certification Note'))
+ report_note = models.TextField(null=True, blank=True, verbose_name=_('Report Note'))
+ misc_expenses = models.TextField(null=True, blank=True, verbose_name=_('Misc Expenses'))
+
+ status = FSMField(default=PLANNED, choices=CHOICES, protected=True, verbose_name=_('Status'))
+ traveler = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, related_name='travels',
+ verbose_name=_('Travellert'))
+ supervisor = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, related_name='+',
+ verbose_name=_('Supervisor'))
+ office = models.ForeignKey('users.Office', null=True, blank=True, related_name='+', verbose_name=_('Office'))
+ section = models.ForeignKey('users.Section', null=True, blank=True, related_name='+', verbose_name=_('Section'))
+ sector = models.ForeignKey('reports.Sector', null=True, blank=True, related_name='+', verbose_name=_('Sector'))
+ start_date = models.DateTimeField(null=True, blank=True, verbose_name=_('Start Date'))
+ end_date = models.DateTimeField(null=True, blank=True, verbose_name=_('End Date'))
+ purpose = models.CharField(max_length=500, null=True, blank=True, verbose_name=_('Purpose'))
+ additional_note = models.TextField(null=True, blank=True, verbose_name=_('Additional Note'))
+ international_travel = models.NullBooleanField(default=False, null=True, blank=True,
+ verbose_name=_('International Travel'))
+ ta_required = models.NullBooleanField(default=True, null=True, blank=True, verbose_name=_('TA Required'))
+ reference_number = models.CharField(max_length=12, default=make_travel_reference_number, unique=True,
+ verbose_name=_('Reference Number'))
+ hidden = models.BooleanField(default=False, verbose_name=_('Hidden'))
+ mode_of_travel = ArrayField(models.CharField(max_length=5, choices=ModeOfTravel.CHOICES), null=True, blank=True,
+ verbose_name=_('Mode of Travel'))
+ estimated_travel_cost = models.DecimalField(max_digits=20, decimal_places=4, default=0,
+ verbose_name=_('Estimated Travel Cost'))
+ currency = models.ForeignKey('publics.Currency', related_name='+', null=True, blank=True,
+ verbose_name=_('Currency'))
+ is_driver = models.BooleanField(default=False, verbose_name=_('Is Driver'))
# When the travel is sent for payment, the expenses should be saved for later use
- preserved_expenses_local = models.DecimalField(max_digits=20, decimal_places=4, null=True, blank=True, default=None)
- preserved_expenses_usd = models.DecimalField(max_digits=20, decimal_places=4, null=True, blank=True, default=None)
- approved_cost_traveler = models.DecimalField(max_digits=20, decimal_places=4, null=True, blank=True, default=None)
- approved_cost_travel_agencies = models.DecimalField(max_digits=20, decimal_places=4,
- null=True, blank=True, default=None)
+ preserved_expenses_local = models.DecimalField(max_digits=20, decimal_places=4, null=True, blank=True, default=None,
+ verbose_name=_('Preserved Expenses (Local)'))
+ preserved_expenses_usd = models.DecimalField(max_digits=20, decimal_places=4, null=True, blank=True, default=None,
+ verbose_name=_('Preserved Expenses (USD)'))
+ approved_cost_traveler = models.DecimalField(max_digits=20, decimal_places=4, null=True, blank=True, default=None,
+ verbose_name=_('Approved Cost Traveler'))
+ approved_cost_travel_agencies = models.DecimalField(max_digits=20, decimal_places=4, null=True, blank=True,
+ default=None, verbose_name=_('Approved Cost Travel Agencies'))
def __str__(self):
return self.reference_number
@@ -440,16 +450,19 @@ def generate_invoices(self):
class TravelActivity(models.Model):
- travels = models.ManyToManyField('Travel', related_name='activities')
- travel_type = models.CharField(max_length=64, choices=TravelType.CHOICES, null=True, blank=True)
- partner = models.ForeignKey('partners.PartnerOrganization', null=True, blank=True, related_name='+')
+ travels = models.ManyToManyField('Travel', related_name='activities', verbose_name=_('Travels'))
+ travel_type = models.CharField(max_length=64, choices=TravelType.CHOICES, null=True, blank=True,
+ verbose_name=_('Travel Type'))
+ partner = models.ForeignKey('partners.PartnerOrganization', null=True, blank=True, related_name='+',
+ verbose_name=_('Partner'))
# Partnership has to be filtered based on partner
# TODO: assert self.partnership.agreement.partner == self.partner
- partnership = models.ForeignKey('partners.Intervention', null=True, blank=True, related_name='travel_activities')
- result = models.ForeignKey('reports.Result', null=True, blank=True, related_name='+')
- locations = models.ManyToManyField('locations.Location', related_name='+')
- primary_traveler = models.ForeignKey(settings.AUTH_USER_MODEL)
- date = models.DateTimeField(null=True, blank=True)
+ partnership = models.ForeignKey('partners.Intervention', null=True, blank=True, related_name='travel_activities',
+ verbose_name=_('Partnership'))
+ result = models.ForeignKey('reports.Result', null=True, blank=True, related_name='+', verbose_name=_('Result'))
+ locations = models.ManyToManyField('locations.Location', related_name='+', verbose_name=_('Locations'))
+ primary_traveler = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('Primary Traveler'))
+ date = models.DateTimeField(null=True, blank=True, verbose_name=_('Date'))
class Meta:
verbose_name_plural = _("Travel Activities")
@@ -461,15 +474,17 @@ def travel_status(self):
@python_2_unicode_compatible
class ItineraryItem(models.Model):
- travel = models.ForeignKey('Travel', related_name='itinerary')
- origin = models.CharField(max_length=255)
- destination = models.CharField(max_length=255)
- departure_date = models.DateTimeField()
- arrival_date = models.DateTimeField()
- dsa_region = models.ForeignKey('publics.DSARegion', related_name='+', null=True, blank=True)
- overnight_travel = models.BooleanField(default=False)
- mode_of_travel = models.CharField(max_length=5, choices=ModeOfTravel.CHOICES, null=True, blank=True)
- airlines = models.ManyToManyField('publics.AirlineCompany', related_name='+')
+ travel = models.ForeignKey('Travel', related_name='itinerary', verbose_name=_('Travel'))
+ origin = models.CharField(max_length=255, verbose_name=_('Origin'))
+ destination = models.CharField(max_length=255, verbose_name=_('Destination'))
+ departure_date = models.DateTimeField(verbose_name=_('Departure Date'))
+ arrival_date = models.DateTimeField(verbose_name=_('Arrival Date'))
+ dsa_region = models.ForeignKey('publics.DSARegion', related_name='+', null=True, blank=True,
+ verbose_name=_('DSA Region'))
+ overnight_travel = models.BooleanField(default=False, verbose_name=_('Overnight Travel'))
+ mode_of_travel = models.CharField(max_length=5, choices=ModeOfTravel.CHOICES, null=True, blank=True,
+ verbose_name=_('Mode of Travel'))
+ airlines = models.ManyToManyField('publics.AirlineCompany', related_name='+', verbose_name=_('Airlines'))
class Meta:
# https://docs.djangoproject.com/en/1.9/ref/models/options/#order-with-respect-to
@@ -482,10 +497,12 @@ def __str__(self):
class Expense(models.Model):
- travel = models.ForeignKey('Travel', related_name='expenses')
- type = models.ForeignKey('publics.TravelExpenseType', related_name='+', null=True, blank=True)
- currency = models.ForeignKey('publics.Currency', related_name='+', null=True, blank=True)
- amount = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True)
+ travel = models.ForeignKey('Travel', related_name='expenses', verbose_name=_('Travel'))
+ type = models.ForeignKey('publics.TravelExpenseType', related_name='+', null=True, blank=True,
+ verbose_name=_('Type'))
+ currency = models.ForeignKey('publics.Currency', related_name='+', null=True, blank=True,
+ verbose_name=_('Currency'))
+ amount = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True, verbose_name=_('Amount'))
@property
def usd_amount(self):
@@ -496,13 +513,13 @@ def usd_amount(self):
class Deduction(models.Model):
- travel = models.ForeignKey('Travel', related_name='deductions')
- date = models.DateField()
- breakfast = models.BooleanField(default=False)
- lunch = models.BooleanField(default=False)
- dinner = models.BooleanField(default=False)
- accomodation = models.BooleanField(default=False)
- no_dsa = models.BooleanField(default=False)
+ travel = models.ForeignKey('Travel', related_name='deductions', verbose_name=_('Deduction'))
+ date = models.DateField(verbose_name=_('Date'))
+ breakfast = models.BooleanField(default=False, verbose_name=_('Breakfast'))
+ lunch = models.BooleanField(default=False, verbose_name=_('Lunch'))
+ dinner = models.BooleanField(default=False, verbose_name=_('Dinner'))
+ accomodation = models.BooleanField(default=False, verbose_name=_('Accomodation'))
+ no_dsa = models.BooleanField(default=False, verbose_name=_('No DSA'))
@property
def day_of_the_week(self):
@@ -528,13 +545,17 @@ def multiplier(self):
class CostAssignment(models.Model):
- travel = models.ForeignKey('Travel', related_name='cost_assignments')
- share = models.PositiveIntegerField()
- delegate = models.BooleanField(default=False)
- business_area = models.ForeignKey('publics.BusinessArea', related_name='+', null=True, blank=True)
- wbs = models.ForeignKey('publics.WBS', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING)
- grant = models.ForeignKey('publics.Grant', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING)
- fund = models.ForeignKey('publics.Fund', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING)
+ travel = models.ForeignKey('Travel', related_name='cost_assignments', verbose_name=_('Travel'))
+ share = models.PositiveIntegerField(verbose_name=_('Share'))
+ delegate = models.BooleanField(default=False, verbose_name=_('Delegate'))
+ business_area = models.ForeignKey('publics.BusinessArea', related_name='+', null=True, blank=True,
+ verbose_name=_('Business Area'))
+ wbs = models.ForeignKey('publics.WBS', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING,
+ verbose_name=_('WBS'))
+ grant = models.ForeignKey('publics.Grant', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING,
+ verbose_name=_('Grant'))
+ fund = models.ForeignKey('publics.Fund', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING,
+ verbose_name=_('Fund'))
class Clearances(models.Model):
@@ -547,10 +568,13 @@ class Clearances(models.Model):
(NOT_APPLICABLE, 'not_applicable'),
)
- travel = models.OneToOneField('Travel', related_name='clearances')
- medical_clearance = models.CharField(max_length=14, choices=CHOICES, default=NOT_APPLICABLE)
- security_clearance = models.CharField(max_length=14, choices=CHOICES, default=NOT_APPLICABLE)
- security_course = models.CharField(max_length=14, choices=CHOICES, default=NOT_APPLICABLE)
+ travel = models.OneToOneField('Travel', related_name='clearances', verbose_name=_('Travel'))
+ medical_clearance = models.CharField(max_length=14, choices=CHOICES, default=NOT_APPLICABLE,
+ verbose_name=_('Medical Clearance'))
+ security_clearance = models.CharField(max_length=14, choices=CHOICES, default=NOT_APPLICABLE,
+ verbose_name=_('Security Clearance'))
+ security_course = models.CharField(max_length=14, choices=CHOICES, default=NOT_APPLICABLE,
+ verbose_name=_('Security Course'))
class Meta:
verbose_name_plural = _('Clearances')
@@ -569,11 +593,11 @@ def determine_file_upload_path(instance, filename):
class TravelAttachment(models.Model):
- travel = models.ForeignKey('Travel', related_name='attachments')
- type = models.CharField(max_length=64)
+ travel = models.ForeignKey('Travel', related_name='attachments', verbose_name=_('Travel'))
+ type = models.CharField(max_length=64, verbose_name=_('Type'))
- name = models.CharField(max_length=255)
- file = models.FileField(upload_to=determine_file_upload_path, max_length=255)
+ name = models.CharField(max_length=255, verbose_name=_('Name'))
+ file = models.FileField(upload_to=determine_file_upload_path, max_length=255, verbose_name=_('File'))
def make_action_point_number():
@@ -613,18 +637,20 @@ class ActionPoint(models.Model):
(CANCELLED, 'Cancelled'),
)
- travel = models.ForeignKey('Travel', related_name='action_points')
- action_point_number = models.CharField(max_length=11, default=make_action_point_number, unique=True)
- description = models.CharField(max_length=254)
- due_date = models.DateTimeField()
- person_responsible = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+')
+ travel = models.ForeignKey('Travel', related_name='action_points', verbose_name=_('Travel'))
+ action_point_number = models.CharField(max_length=11, default=make_action_point_number, unique=True,
+ verbose_name=_('Action Point Number'))
+ description = models.CharField(max_length=254, verbose_name=_('Description'))
+ due_date = models.DateTimeField(verbose_name=_('Due Date'))
+ person_responsible = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+',
+ verbose_name=_('Responsible Person'))
status = models.CharField(choices=STATUS, max_length=254, null=True, blank=True, verbose_name='Status')
- completed_at = models.DateTimeField(blank=True, null=True)
- actions_taken = models.TextField(blank=True, null=True)
- follow_up = models.BooleanField(default=False)
- comments = models.TextField(blank=True, null=True)
- created_at = models.DateTimeField(auto_now_add=True)
- assigned_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+')
+ completed_at = models.DateTimeField(blank=True, null=True, verbose_name=_('Completed At'))
+ actions_taken = models.TextField(blank=True, null=True, verbose_name=_('Actions Taken'))
+ follow_up = models.BooleanField(default=False, verbose_name=_('Follow up'))
+ comments = models.TextField(blank=True, null=True, verbose_name=_('Comments'))
+ created_at = models.DateTimeField(auto_now_add=True, verbose_name=_('Created At'))
+ assigned_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+', verbose_name=_('Assigned By'))
def save(self, *args, **kwargs):
created = self.pk is None
@@ -680,15 +706,15 @@ class Invoice(models.Model):
(ERROR, 'Error'),
)
- travel = models.ForeignKey('Travel', related_name='invoices')
- reference_number = models.CharField(max_length=32, unique=True)
- business_area = models.CharField(max_length=32)
- vendor_number = models.CharField(max_length=32)
- currency = models.ForeignKey('publics.Currency', related_name='+')
- amount = models.DecimalField(max_digits=20, decimal_places=4)
- status = models.CharField(max_length=16, choices=STATUS)
- messages = ArrayField(models.TextField(null=True, blank=True), default=[])
- vision_fi_id = models.CharField(max_length=16, null=True, blank=True)
+ travel = models.ForeignKey('Travel', related_name='invoices', verbose_name=_('Travel'))
+ reference_number = models.CharField(max_length=32, unique=True, verbose_name=_('Reference Number'))
+ business_area = models.CharField(max_length=32, verbose_name=_('Business Area'))
+ vendor_number = models.CharField(max_length=32, verbose_name=_('Vendor Number'))
+ currency = models.ForeignKey('publics.Currency', related_name='+', verbose_name=_('Currency'))
+ amount = models.DecimalField(max_digits=20, decimal_places=4, verbose_name=_('Amount'))
+ status = models.CharField(max_length=16, choices=STATUS, verbose_name=_('Status'))
+ messages = ArrayField(models.TextField(null=True, blank=True), default=[], verbose_name=_('Messages'))
+ vision_fi_id = models.CharField(max_length=16, null=True, blank=True, verbose_name=_('Vision FI ID'))
def save(self, **kwargs):
if self.pk is None:
@@ -717,10 +743,13 @@ def __str__(self):
class InvoiceItem(models.Model):
- invoice = models.ForeignKey('Invoice', related_name='items')
- wbs = models.ForeignKey('publics.WBS', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING)
- grant = models.ForeignKey('publics.Grant', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING)
- fund = models.ForeignKey('publics.Fund', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING)
+ invoice = models.ForeignKey('Invoice', related_name='items', verbose_name=_('Invoice'))
+ wbs = models.ForeignKey('publics.WBS', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING,
+ verbose_name=_(''))
+ grant = models.ForeignKey('publics.Grant', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING,
+ verbose_name=_('Grant'))
+ fund = models.ForeignKey('publics.Fund', related_name='+', null=True, blank=True, on_delete=models.DO_NOTHING,
+ verbose_name=_('Fund'))
amount = models.DecimalField(max_digits=20, decimal_places=10)
@property
diff --git a/EquiTrack/tpm/migrations/0001_initial.py b/EquiTrack/tpm/migrations/0001_initial.py
index 658638474..ae0976ec9 100644
--- a/EquiTrack/tpm/migrations/0001_initial.py
+++ b/EquiTrack/tpm/migrations/0001_initial.py
@@ -1,38 +1,131 @@
# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
-from django.db import models, migrations
+import datetime
from django.conf import settings
-import EquiTrack.mixins
+from django.db import migrations, models
+import django.db.models.deletion
+import django.db.models.manager
+from django.utils.timezone import utc
+import django.utils.timezone
+import django_fsm
+import model_utils.fields
class Migration(migrations.Migration):
+ initial = True
+
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('partners', '0001_initial'),
+ ('users', '0001_initial'),
+ ('reports', '0001_initial'),
+ ('tpmpartners', '0001_initial'),
+ ('activities', '0001_initial'),
]
operations = [
+ migrations.CreateModel(
+ name='TPMActionPoint',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('due_date', models.DateField(verbose_name='Due Date')),
+ ('description', models.TextField(verbose_name='Description')),
+ ('comments', models.TextField(blank=True, verbose_name='Comments')),
+ ('status', models.CharField(choices=[('open', 'Open'), ('progress', 'In-Progress'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], default='open', max_length=9, verbose_name='Status')),
+ ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_tpm_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Assigned By')),
+ ('person_responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Person Responsible')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ migrations.CreateModel(
+ name='TPMActivity',
+ fields=[
+ ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='activities.Activity')),
+ ('additional_information', models.TextField(blank=True, verbose_name='Additional Information')),
+ ('is_pv', models.BooleanField(default=False, verbose_name='HACT Programmatic Visit')),
+ ('section', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_activities', to='reports.Sector', verbose_name='Section')),
+ ],
+ options={
+ 'ordering': ['tpm_visit', 'id'],
+ 'verbose_name_plural': 'TPM Activities',
+ },
+ bases=('activities.activity',),
+ ),
+ migrations.CreateModel(
+ name='TPMPermission',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('user_type', models.CharField(max_length=30)),
+ ('permission', models.CharField(choices=[('view', 'View'), ('edit', 'Edit'), ('action', 'Action')], max_length=10)),
+ ('permission_type', models.CharField(choices=[('allow', 'Allow'), ('disallow', 'Disallow')], default='allow', max_length=10)),
+ ('target', models.CharField(max_length=100)),
+ ('instance_status', models.CharField(max_length=32, verbose_name='Instance Status')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
migrations.CreateModel(
name='TPMVisit',
fields=[
- ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
- ('status', models.CharField(default='planned', max_length=32L, choices=[('planned', 'Planned'), ('completed', 'Completed'), ('rescheduled', 'Rescheduled'), ('no-activity', 'No-Activity'), ('discontinued', 'Discontinued')])),
- ('cycle_number', models.PositiveIntegerField(null=True, blank=True)),
- ('tentative_date', models.DateField(null=True, blank=True)),
- ('completed_date', models.DateField(null=True, blank=True)),
- ('comments', models.TextField(null=True, blank=True)),
- ('created_date', models.DateTimeField(auto_now_add=True)),
- ('report', models.FileField(null=True, upload_to='tpm_reports', blank=True)),
- ('assigned_by', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
- ('pca', models.ForeignKey(to='partners.PCA')),
- ('pca_location', models.ForeignKey(blank=True, to='partners.GwPCALocation', null=True)),
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc), verbose_name='Deleted At')),
+ ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
+ ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
+ ('status', django_fsm.FSMField(choices=[('draft', 'Draft'), ('assigned', 'Assigned'), ('cancelled', 'Cancelled'), ('tpm_accepted', 'TPM Accepted'), ('tpm_rejected', 'TPM Rejected'), ('tpm_reported', 'TPM Reported'), ('tpm_report_rejected', 'Sent Back to TPM'), ('unicef_approved', 'UNICEF Approved')], default='draft', max_length=20, protected=True, verbose_name='Status')),
+ ('reject_comment', models.TextField(blank=True, verbose_name='Request For More Information')),
+ ('approval_comment', models.TextField(blank=True, verbose_name='Approval Comments')),
+ ('visit_information', models.TextField(blank=True, verbose_name='Visit Information')),
+ ('date_of_assigned', models.DateField(blank=True, null=True, verbose_name='Date of Assigned')),
+ ('date_of_cancelled', models.DateField(blank=True, null=True, verbose_name='Date of Cancelled')),
+ ('date_of_tpm_accepted', models.DateField(blank=True, null=True, verbose_name='Date of TPM Accepted')),
+ ('date_of_tpm_rejected', models.DateField(blank=True, null=True, verbose_name='Date of TPM Rejected')),
+ ('date_of_tpm_reported', models.DateField(blank=True, null=True, verbose_name='Date of TPM Reported')),
+ ('date_of_tpm_report_rejected', models.DateField(blank=True, null=True, verbose_name='Date of Sent Back to TPM')),
+ ('date_of_unicef_approved', models.DateField(blank=True, null=True, verbose_name='Date of UNICEF Approved')),
+ ('offices', models.ManyToManyField(blank=True, related_name='tpm_visits', to='users.Office', verbose_name='Office(s) of UNICEF Focal Point(s)')),
+ ('tpm_partner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tpmpartners.TPMPartner', verbose_name='TPM Vendor')),
+ ('tpm_partner_focal_points', models.ManyToManyField(blank=True, related_name='tpm_visits', to='tpmpartners.TPMPartnerStaffMember', verbose_name='TPM Focal Points')),
+ ('unicef_focal_points', models.ManyToManyField(blank=True, related_name='tpm_visits', to=settings.AUTH_USER_MODEL, verbose_name='UNICEF Focal Points')),
+ ],
+ options={
+ 'abstract': False,
+ },
+ managers=[
+ ('admin_objects', django.db.models.manager.Manager()),
+ ],
+ ),
+ migrations.CreateModel(
+ name='TPMVisitReportRejectComment',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('rejected_at', models.DateTimeField(auto_now_add=True, verbose_name='Rejected At')),
+ ('reject_reason', models.TextField(verbose_name='Reason of Rejection')),
+ ('tpm_visit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='report_reject_comments', to='tpm.TPMVisit', verbose_name='Visit')),
],
options={
- 'verbose_name': 'TPM Visit',
- 'verbose_name_plural': 'TPM Visits',
+ 'ordering': ['tpm_visit', 'id'],
+ 'verbose_name_plural': 'Report Reject Comments',
},
- bases=(EquiTrack.mixins.AdminURLMixin, models.Model),
+ ),
+ migrations.AlterUniqueTogether(
+ name='tpmpermission',
+ unique_together=set([('user_type', 'instance_status', 'target', 'permission_type')]),
+ ),
+ migrations.AddField(
+ model_name='tpmactivity',
+ name='tpm_visit',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_activities', to='tpm.TPMVisit', verbose_name='Visit'),
+ ),
+ migrations.AddField(
+ model_name='tpmactionpoint',
+ name='tpm_visit',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_points', to='tpm.TPMVisit', verbose_name='Visit'),
),
]
diff --git a/EquiTrack/tpm/migrations/0002_auto_20170906_1417.py b/EquiTrack/tpm/migrations/0002_auto_20170906_1417.py
deleted file mode 100644
index 04bd45c40..000000000
--- a/EquiTrack/tpm/migrations/0002_auto_20170906_1417.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-10 12:01
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tpm', '0001_initial'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='tpmvisit',
- name='assigned_by',
- ),
- migrations.RemoveField(
- model_name='tpmvisit',
- name='pca',
- ),
- migrations.RemoveField(
- model_name='tpmvisit',
- name='pca_location',
- ),
- migrations.DeleteModel(
- name='TPMVisit',
- ),
- ]
diff --git a/EquiTrack/tpm/migrations/0003_auto_20171214_0745.py b/EquiTrack/tpm/migrations/0003_auto_20171214_0745.py
deleted file mode 100644
index bf35712c0..000000000
--- a/EquiTrack/tpm/migrations/0003_auto_20171214_0745.py
+++ /dev/null
@@ -1,169 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-14 07:45
-from __future__ import unicode_literals
-
-import datetime
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-import django.db.models.manager
-from django.utils.timezone import utc
-import django.utils.timezone
-import django_fsm
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('users', '0010_auto_20171127_2158'),
- ('activities', '0001_initial'),
- ('tpm', '0002_auto_20170906_1417'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='TPMActionPoint',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('due_date', models.DateField(verbose_name='Due Date')),
- ('description', models.TextField(verbose_name='Description')),
- ('comments', models.TextField(blank=True, verbose_name='Comments')),
- ('status', models.CharField(choices=[('open', 'Open'), ('progress', 'In-Progress'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], default='open', max_length=9, verbose_name='Status')),
- ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_tpm_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Assigned By')),
- ('person_responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_action_points', to=settings.AUTH_USER_MODEL, verbose_name='Person Responsible')),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.CreateModel(
- name='TPMActivity',
- fields=[
- ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='activities.Activity')),
- ('additional_information', models.TextField(blank=True, verbose_name='Additional Information')),
- ('is_pv', models.BooleanField(default=False, verbose_name='HACT Programmatic Visit')),
- ('section', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_activities', to='users.Section', verbose_name='Section')),
- ],
- options={
- 'ordering': ['tpm_visit', 'id'],
- 'verbose_name_plural': 'TPM Activities',
- },
- bases=('activities.activity',),
- ),
- migrations.CreateModel(
- name='TPMPartner',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('vendor_number', models.CharField(blank=True, max_length=30, null=True, unique=True, verbose_name='Vendor Number')),
- ('name', models.CharField(max_length=255, verbose_name='Vendor Name')),
- ('street_address', models.CharField(blank=True, max_length=500, null=True, verbose_name='Address')),
- ('city', models.CharField(blank=True, max_length=255, null=True, verbose_name='City')),
- ('postal_code', models.CharField(blank=True, max_length=32, null=True, verbose_name='Postal Code')),
- ('country', models.CharField(blank=True, max_length=255, null=True, verbose_name='Country')),
- ('email', models.CharField(blank=True, max_length=255, null=True, verbose_name='Email')),
- ('phone_number', models.CharField(blank=True, max_length=32, null=True, verbose_name='Phone Number')),
- ('vision_synced', models.BooleanField(default=False, verbose_name='Synced from VISION')),
- ('blocked', models.BooleanField(default=False, verbose_name='Blocked in VISION')),
- ('hidden', models.BooleanField(default=False, verbose_name='Hidden')),
- ('deleted_flag', models.BooleanField(default=False, verbose_name='Marked For Deletion in VISION')),
- ],
- options={
- 'abstract': False,
- 'verbose_name': 'Organization',
- 'verbose_name_plural': 'Organizations',
- },
- ),
- migrations.CreateModel(
- name='TPMPartnerStaffMember',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('receive_tpm_notifications', models.BooleanField(default=False, verbose_name='Receive Notifications on TPM Tasks')),
- ('tpm_partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='staff_members', to='tpm.TPMPartner', verbose_name='TPM Vendor')),
- ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_tpmpartnerstaffmember', to=settings.AUTH_USER_MODEL, verbose_name='User')),
- ],
- options={
- 'abstract': False,
- 'verbose_name': 'Staff Member',
- 'verbose_name_plural': 'Staff Members',
- },
- ),
- migrations.CreateModel(
- name='TPMPermission',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('user_type', models.CharField(max_length=30)),
- ('permission', models.CharField(choices=[('view', 'View'), ('edit', 'Edit'), ('action', 'Action')], max_length=10)),
- ('permission_type', models.CharField(choices=[('allow', 'Allow'), ('disallow', 'Disallow')], default='allow', max_length=10)),
- ('target', models.CharField(max_length=100)),
- ('instance_status', models.CharField(max_length=32)),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.CreateModel(
- name='TPMVisit',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('deleted_at', models.DateTimeField(default=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=utc))),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('status', django_fsm.FSMField(choices=[('draft', 'Draft'), ('assigned', 'Assigned'), ('cancelled', 'Cancelled'), ('tpm_accepted', 'TPM Accepted'), ('tpm_rejected', 'TPM Rejected'), ('tpm_reported', 'TPM Reported'), ('tpm_report_rejected', 'Sent Back to TPM'), ('unicef_approved', 'UNICEF Approved')], default='draft', max_length=20, protected=True, verbose_name='Status')),
- ('reject_comment', models.TextField(blank=True, verbose_name='Request For More Information')),
- ('approval_comment', models.TextField(blank=True, verbose_name='Approval Comments')),
- ('visit_information', models.TextField(blank=True, verbose_name='Visit Information')),
- ('date_of_assigned', models.DateField(blank=True, null=True, verbose_name='Date of Assigned')),
- ('date_of_cancelled', models.DateField(blank=True, null=True, verbose_name='Date of Cancelled')),
- ('date_of_tpm_accepted', models.DateField(blank=True, null=True, verbose_name='Date of TPM Accepted')),
- ('date_of_tpm_rejected', models.DateField(blank=True, null=True, verbose_name='Date of TPM Rejected')),
- ('date_of_tpm_reported', models.DateField(blank=True, null=True, verbose_name='Date of TPM Reported')),
- ('date_of_tpm_report_rejected', models.DateField(blank=True, null=True, verbose_name='Date of Sent Back to TPM')),
- ('date_of_unicef_approved', models.DateField(blank=True, null=True, verbose_name='Date of UNICEF Approved')),
- ('offices', models.ManyToManyField(blank=True, related_name='tpm_visits', to='users.Office', verbose_name='Office(s) of UNICEF Focal Point(s)')),
- ('tpm_partner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tpm.TPMPartner', verbose_name='TPM Vendor')),
- ('tpm_partner_focal_points', models.ManyToManyField(blank=True, related_name='tpm_visits', to='tpm.TPMPartnerStaffMember', verbose_name='TPM Focal Points')),
- ('unicef_focal_points', models.ManyToManyField(blank=True, related_name='tpm_visits', to=settings.AUTH_USER_MODEL, verbose_name='UNICEF Focal Points')),
- ],
- options={
- 'abstract': False,
- },
- managers=[
- ('admin_objects', django.db.models.manager.Manager()),
- ],
- ),
- migrations.CreateModel(
- name='TPMVisitReportRejectComment',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('rejected_at', models.DateTimeField(auto_now_add=True, verbose_name='Rejected At')),
- ('reject_reason', models.TextField(verbose_name='Reason of Rejection')),
- ('tpm_visit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='report_reject_comments', to='tpm.TPMVisit', verbose_name='Visit')),
- ],
- options={
- 'ordering': ['tpm_visit', 'id'],
- 'verbose_name_plural': 'Report Reject Comments',
- },
- ),
- migrations.AlterUniqueTogether(
- name='tpmpermission',
- unique_together=set([('user_type', 'instance_status', 'target', 'permission_type')]),
- ),
- migrations.AddField(
- model_name='tpmactivity',
- name='tpm_visit',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_activities', to='tpm.TPMVisit', verbose_name='Visit'),
- ),
- migrations.AddField(
- model_name='tpmactionpoint',
- name='tpm_visit',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='action_points', to='tpm.TPMVisit', verbose_name='Visit'),
- ),
- ]
diff --git a/EquiTrack/tpm/migrations/0004_auto_20171214_0802.py b/EquiTrack/tpm/migrations/0004_auto_20171214_0802.py
deleted file mode 100644
index 43ba5c414..000000000
--- a/EquiTrack/tpm/migrations/0004_auto_20171214_0802.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.13 on 2017-10-02 13:52
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def update_email_templates(apps, schema_editor):
- EmailTemplate = apps.get_model('post_office', 'EmailTemplate')
-
- EmailTemplate.objects.get_or_create(name='tpm/visit/assign')
- EmailTemplate.objects.get_or_create(name='tpm/visit/reject')
- EmailTemplate.objects.get_or_create(name='tpm/visit/accept')
- EmailTemplate.objects.get_or_create(name='tpm/visit/generate_report')
- EmailTemplate.objects.get_or_create(name='tpm/visit/report')
- EmailTemplate.objects.get_or_create(name='tpm/visit/report_rejected')
- EmailTemplate.objects.get_or_create(name='tpm/visit/approve_report')
- EmailTemplate.objects.get_or_create(name='tpm/visit/approve_report_tpm')
- EmailTemplate.objects.get_or_create(name='tpm/visit/action_point_assigned')
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tpm', '0003_auto_20171214_0745'),
- ('post_office', '0004_auto_20160607_0901'),
- ]
-
- operations = [
- migrations.RunPython(update_email_templates, migrations.RunPython.noop)
- ]
diff --git a/EquiTrack/tpm/migrations/0005_auto_20171208_1353.py b/EquiTrack/tpm/migrations/0005_auto_20171208_1353.py
deleted file mode 100644
index 80d9bbbff..000000000
--- a/EquiTrack/tpm/migrations/0005_auto_20171208_1353.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-08 13:53
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-def migrate_tpm_partners(apps, schema_editor):
- TargetTPMPartner = apps.get_model('tpmpartners', 'TPMPartner')
- TargetTPMPartnerStaffMember = apps.get_model('tpmpartners', 'TPMPartnerStaffMember')
-
- SourceTPMPartner = apps.get_model('tpm', 'TPMPartner')
- SourceTPMPartnerStaffMember = apps.get_model('tpm', 'TPMPartnerStaffMember')
-
- partners = dict()
- for partner in SourceTPMPartner.objects.all():
- if TargetTPMPartner.objects.filter(vendor_number=partner.vendor_number).exists():
- partner = TargetTPMPartner.objects.get(vendor_number=partner.vendor_number)
-
- else:
- partner.__class__ = TargetTPMPartner
- partner.id = None
- partner.save()
-
- partners[partner.vendor_number] = partner
-
- for staff_member in SourceTPMPartnerStaffMember.objects.select_related('tpm_partner'):
- if not TargetTPMPartnerStaffMember.objects.filter(user_id=staff_member.user_id).exists():
- staff_member.__class__ = TargetTPMPartnerStaffMember
- staff_member.id = None
- staff_member.tpm_partner = partners[staff_member.tpm_partner.vendor_number]
- staff_member.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tpm', '0004_auto_20171214_0802'),
- ('tpmpartners', '0001_initial'),
- ]
-
- operations = [
- migrations.RunPython(
- migrate_tpm_partners,
- ),
- ]
diff --git a/EquiTrack/tpm/migrations/0006_auto_20171208_1407.py b/EquiTrack/tpm/migrations/0006_auto_20171208_1407.py
deleted file mode 100644
index 024ca1467..000000000
--- a/EquiTrack/tpm/migrations/0006_auto_20171208_1407.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-08 14:07
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tpm', '0005_auto_20171208_1353'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='tpmvisit',
- name='tpm_partner1',
- field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tpmpartners.TPMPartner', verbose_name='TPM Vendor'),
- ),
- migrations.AddField(
- model_name='tpmvisit',
- name='tpm_partner_focal_points1',
- field=models.ManyToManyField(blank=True, related_name='tpm_visits', to='tpmpartners.TPMPartnerStaffMember', verbose_name='TPM Focal Points'),
- ),
- ]
diff --git a/EquiTrack/tpm/migrations/0007_auto_20171208_1407.py b/EquiTrack/tpm/migrations/0007_auto_20171208_1407.py
deleted file mode 100644
index 6e9a2ed7d..000000000
--- a/EquiTrack/tpm/migrations/0007_auto_20171208_1407.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-08 14:07
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-def migrate_tpm_partner_relation(apps, schema_editor):
- TPMVisit = apps.get_model('tpm', 'TPMVisit')
- TargetTPMPartner = apps.get_model('tpmpartners', 'TPMPartner')
- TargetTPMPartnerStaffMember = apps.get_model('tpmpartners', 'TPMPartnerStaffMember')
-
- partner_cache = dict()
- for visit in TPMVisit._default_manager.select_related('tpm_partner'):
- tpm_partner = partner_cache.get(visit.tpm_partner.vendor_number, None)
- if tpm_partner is None:
- tpm_partner = TargetTPMPartner.objects.get(vendor_number=visit.tpm_partner.vendor_number)
- partner_cache[tpm_partner.vendor_number] = tpm_partner
-
- visit.tpm_partner1 = tpm_partner
- visit.save()
-
- staff_member_cache = dict()
- for visit in TPMVisit._default_manager.prefetch_related('tpm_partner_focal_points'):
-
- target_staff_members = []
- for staff_member in visit.tpm_partner_focal_points.all():
-
- target_staff_member = staff_member_cache.get(staff_member.user_id, None)
- if target_staff_member is None:
- target_staff_member = TargetTPMPartnerStaffMember.objects.get(user_id=staff_member.user_id)
- staff_member_cache[target_staff_member.user_id] = target_staff_member
-
- target_staff_members.append(target_staff_member)
-
- visit.tpm_partner_focal_points1 = target_staff_members
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tpm', '0006_auto_20171208_1407'),
- ]
-
- operations = [
- migrations.RunPython(
- migrate_tpm_partner_relation,
- ),
- ]
diff --git a/EquiTrack/tpm/migrations/0008_auto_20171208_1421.py b/EquiTrack/tpm/migrations/0008_auto_20171208_1421.py
deleted file mode 100644
index c28f913f0..000000000
--- a/EquiTrack/tpm/migrations/0008_auto_20171208_1421.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-08 14:21
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tpm', '0007_auto_20171208_1407'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='tpmpartnerstaffmember',
- name='tpm_partner',
- ),
- migrations.RemoveField(
- model_name='tpmpartnerstaffmember',
- name='user',
- ),
- migrations.RemoveField(
- model_name='tpmvisit',
- name='tpm_partner',
- ),
- migrations.RemoveField(
- model_name='tpmvisit',
- name='tpm_partner_focal_points',
- ),
- migrations.DeleteModel(
- name='TPMPartner',
- ),
- migrations.DeleteModel(
- name='TPMPartnerStaffMember',
- ),
- migrations.RenameField(
- model_name='tpmvisit',
- old_name='tpm_partner1',
- new_name='tpm_partner',
- ),
- migrations.RenameField(
- model_name='tpmvisit',
- old_name='tpm_partner_focal_points1',
- new_name='tpm_partner_focal_points',
- ),
- ]
diff --git a/EquiTrack/tpm/migrations/0009_auto_20180226_0911.py b/EquiTrack/tpm/migrations/0009_auto_20180226_0911.py
deleted file mode 100644
index 7d922d3ea..000000000
--- a/EquiTrack/tpm/migrations/0009_auto_20180226_0911.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-02-26 09:11
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-def migrate_sections_to_sectors(apps, schema_editor):
- Sector = apps.get_model('reports', 'Sector')
- TPMActivity = apps.get_model('tpm', 'TPMActivity')
-
- first_sector = Sector.objects.first()
-
- for activity in TPMActivity.objects.all():
- activity.section = Sector.objects.filter(name=activity.section1.name).first() or first_sector
- activity.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('tpm', '0008_auto_20171208_1421'),
- ('users', '0010_auto_20171127_2158'),
- ('reports', '0017_indicators_p2'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='tpmactivity',
- name='section',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_activities', to='users.Section', null=True, verbose_name='Section'),
- ),
- migrations.RenameField(
- model_name='tpmactivity',
- old_name='section',
- new_name='section1',
- ),
- migrations.AddField(
- model_name='tpmactivity',
- name='section',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.Sector', null=True),
- ),
- migrations.RunPython(migrate_sections_to_sectors, migrations.RunPython.noop),
- migrations.RemoveField(
- model_name='tpmactivity',
- name='section1',
- ),
- migrations.AlterField(
- model_name='tpmactivity',
- name='section',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tpm_activities', to='reports.Sector', verbose_name='Section'),
- ),
- ]
diff --git a/EquiTrack/tpm/tests/test_models.py b/EquiTrack/tpm/tests/test_models.py
index e0bdfbe6d..1c4c8a138 100644
--- a/EquiTrack/tpm/tests/test_models.py
+++ b/EquiTrack/tpm/tests/test_models.py
@@ -2,6 +2,7 @@
from django.contrib.auth.models import User
from django.core import mail
+from django.core.management import call_command
from EquiTrack.tests.cases import BaseTenantTestCase
from tpm.models import ThirdPartyMonitor
@@ -34,9 +35,11 @@ def test_visit_attachments_pv_applicable(self):
class TPMStaffMemberTestCase(BaseTenantTestCase):
+
@classmethod
def setUpTestData(cls):
cls.firm = TPMPartnerFactory()
+ call_command('update_notifications')
def test_signal(self):
ThirdPartyMonitor.invalidate_cache()
diff --git a/EquiTrack/tpm/tpmpartners/migrations/0001_initial.py b/EquiTrack/tpm/tpmpartners/migrations/0001_initial.py
index 644045953..a8c98d1c0 100644
--- a/EquiTrack/tpm/tpmpartners/migrations/0001_initial.py
+++ b/EquiTrack/tpm/tpmpartners/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-12-08 13:21
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.conf import settings
diff --git a/EquiTrack/trips/__init__.py b/EquiTrack/trips/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/EquiTrack/trips/migrations/0001_initial.py b/EquiTrack/trips/migrations/0001_initial.py
deleted file mode 100644
index 2321cdae7..000000000
--- a/EquiTrack/trips/migrations/0001_initial.py
+++ /dev/null
@@ -1,203 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:22
-from __future__ import unicode_literals
-
-import EquiTrack.mixins
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-import smart_selects.db_fields
-import trips.models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ('contenttypes', '0002_remove_content_type_name'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('funds', '0001_initial'),
- ('users', '__first__'),
- ('reports', '0001_initial'),
- ('locations', '0001_initial'),
- ('partners', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='ActionPoint',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('description', models.CharField(max_length=254)),
- ('due_date', models.DateField()),
- ('actions_taken', models.TextField(blank=True, null=True)),
- ('completed_date', models.DateField(blank=True, null=True)),
- ('comments', models.TextField(blank=True, null=True)),
- ('status', models.CharField(choices=[('closed', 'Closed'), ('ongoing', 'On-going'), ('open', 'Open'), ('cancelled', 'Cancelled')], max_length=254, null=True, verbose_name='Status')),
- ('created_date', models.DateTimeField(auto_now_add=True)),
- ('follow_up', models.BooleanField(default=False)),
- ('person_responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='for_action', to=settings.AUTH_USER_MODEL)),
- ],
- ),
- migrations.CreateModel(
- name='FileAttachment',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('caption', models.TextField(blank=True, help_text='Description of the file to upload: optional', null=True, verbose_name='Caption / Description')),
- ('report', models.FileField(max_length=255, upload_to=trips.models.get_report_filename)),
- ('object_id', models.PositiveIntegerField(blank=True, null=True)),
- ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
- ],
- ),
- migrations.CreateModel(
- name='LinkedGovernmentPartner',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('intervention', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='trips', to='partners.GovernmentIntervention')),
- ('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization')),
- ('result', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='intervention', chained_model_field='intervention', null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.GovernmentInterventionResult')),
- ],
- ),
- migrations.CreateModel(
- name='LinkedPartner',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('intervention', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='partner', chained_model_field='partner', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='trips', to='partners.PCA')),
- ('partner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.PartnerOrganization')),
- ('result', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='intervention', chained_model_field='partnership', null=True, on_delete=django.db.models.deletion.CASCADE, to='partners.ResultChain')),
- ],
- ),
- migrations.CreateModel(
- name='TravelRoutes',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('origin', models.CharField(max_length=254)),
- ('destination', models.CharField(max_length=254)),
- ('depart', models.DateTimeField()),
- ('arrive', models.DateTimeField()),
- ('remarks', models.CharField(blank=True, max_length=254, null=True)),
- ],
- options={
- 'verbose_name': 'Travel Itinerary',
- 'verbose_name_plural': 'Travel Itinerary',
- },
- ),
- migrations.CreateModel(
- name='Trip',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('status', models.CharField(choices=[('planned', 'Planned'), ('submitted', 'Submitted'), ('approved', 'Approved'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], default='planned', max_length=32L)),
- ('cancelled_reason', models.CharField(blank=True, help_text='Please provide a reason if the mission is cancelled', max_length=254, null=True)),
- ('purpose_of_travel', models.CharField(max_length=254)),
- ('travel_type', models.CharField(choices=[('programme_monitoring', 'PROGRAMMATIC VISIT'), ('spot_check', 'SPOT CHECK'), ('advocacy', 'ADVOCACY'), ('technical_support', 'TECHNICAL SUPPORT'), ('meeting', 'MEETING'), ('staff_development', 'STAFF DEVELOPMENT'), ('staff_entitlement', 'STAFF ENTITLEMENT')], default='programme_monitoring', max_length=32L)),
- ('security_clearance_required', models.BooleanField(default=False, help_text='Do you need security clarance for this trip?')),
- ('international_travel', models.BooleanField(default=False, help_text='International travel will require approval from the representative')),
- ('from_date', models.DateField()),
- ('to_date', models.DateField()),
- ('main_observations', models.TextField(blank=True, null=True)),
- ('constraints', models.TextField(blank=True, null=True)),
- ('lessons_learned', models.TextField(blank=True, null=True)),
- ('opportunities', models.TextField(blank=True, null=True)),
- ('ta_required', models.BooleanField(default=False, help_text='Is a Travel Authorisation (TA) is required?', verbose_name='TA required?')),
- ('ta_drafted', models.BooleanField(default=False, help_text='Has the TA been drafted in vision if applicable?', verbose_name='TA drafted?')),
- ('ta_drafted_date', models.DateField(blank=True, null=True, verbose_name='TA drafted date')),
- ('ta_reference', models.CharField(blank=True, max_length=254, null=True, verbose_name='TA reference')),
- ('transport_booked', models.BooleanField(default=False)),
- ('security_granted', models.BooleanField(default=False)),
- ('approved_by_supervisor', models.BooleanField(default=False)),
- ('date_supervisor_approved', models.DateField(blank=True, null=True)),
- ('approved_by_budget_owner', models.BooleanField(default=False)),
- ('date_budget_owner_approved', models.DateField(blank=True, null=True)),
- ('approved_by_human_resources', models.NullBooleanField(choices=[(None, 'N/A'), (True, 'Yes'), (False, 'No')], default=None, help_text='HR must approve all trips relating to training and staff development', verbose_name='Certified by human resources')),
- ('date_human_resources_approved', models.DateField(blank=True, null=True)),
- ('representative_approval', models.NullBooleanField(choices=[(None, 'N/A'), (True, 'Yes'), (False, 'No')], default=None)),
- ('date_representative_approved', models.DateField(blank=True, null=True)),
- ('approved_date', models.DateField(blank=True, null=True)),
- ('created_date', models.DateTimeField(auto_now_add=True)),
- ('approved_email_sent', models.BooleanField(default=False)),
- ('submitted_email_sent', models.BooleanField(default=False)),
- ('ta_trip_took_place_as_planned', models.BooleanField(default=False, help_text='I certify that the travel took place exactly as per the attached Travel Authorization and that there were no changes to the itinerary', verbose_name='TA trip took place as attached')),
- ('ta_trip_repay_travel_allowance', models.BooleanField(default=False, help_text='I certify that I will repay any travel allowance to which I am not entitled')),
- ('ta_trip_final_claim', models.BooleanField(default=False, help_text='I authorize UNICEF to treat this as the FINAL Claim')),
- ('pending_ta_amendment', models.BooleanField(default=False)),
- ('budget_owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='budgeted_trips', to=settings.AUTH_USER_MODEL)),
- ('driver', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='trips_driver', to=settings.AUTH_USER_MODEL, verbose_name='Driver')),
- ('driver_supervisor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='driver_supervised_trips', to=settings.AUTH_USER_MODEL, verbose_name='Supervisor for Driver')),
- ('driver_trip', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='drivers_trip', to='trips.Trip')),
- ('human_resources', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='certified_trips', to=settings.AUTH_USER_MODEL)),
- ('office', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Office')),
- ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trips', to=settings.AUTH_USER_MODEL, verbose_name='Traveller')),
- ('partners', models.ManyToManyField(blank=True, to='partners.PartnerOrganization')),
- ('pcas', models.ManyToManyField(blank=True, to='partners.PCA', verbose_name='Related Interventions')),
- ('programme_assistant', models.ForeignKey(blank=True, help_text='Needed if a Travel Authorisation (TA) is required', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='managed_trips', to=settings.AUTH_USER_MODEL, verbose_name='Staff Responsible for TA')),
- ('representative', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='approved_trips', to=settings.AUTH_USER_MODEL)),
- ('section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Section')),
- ('supervisor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='supervised_trips', to=settings.AUTH_USER_MODEL)),
- ('travel_assistant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='organised_trips', to=settings.AUTH_USER_MODEL, verbose_name='Travel focal point')),
- ('vision_approver', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='VISION Approver')),
- ],
- options={
- 'ordering': ['-created_date'],
- },
- bases=(EquiTrack.mixins.AdminURLMixin, models.Model),
- ),
- migrations.CreateModel(
- name='TripFunds',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('amount', models.PositiveIntegerField(verbose_name='Percentage (%)')),
- ('grant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.Grant')),
- ('trip', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='trips.Trip')),
- ('wbs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.Result', verbose_name='WBS')),
- ],
- options={
- 'verbose_name': 'Funding',
- 'verbose_name_plural': 'Funding',
- },
- ),
- migrations.CreateModel(
- name='TripLocation',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('governorate', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Governorate')),
- ('locality', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Locality')),
- ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')),
- ('region', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Region')),
- ('trip', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='trips.Trip')),
- ],
- options={
- 'ordering': ['id'],
- },
- ),
- migrations.AddField(
- model_name='travelroutes',
- name='trip',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='trips.Trip'),
- ),
- migrations.AddField(
- model_name='linkedpartner',
- name='trip',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='trips.Trip'),
- ),
- migrations.AddField(
- model_name='linkedgovernmentpartner',
- name='trip',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='trips.Trip'),
- ),
- migrations.AddField(
- model_name='fileattachment',
- name='trip',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='files', to='trips.Trip'),
- ),
- migrations.AddField(
- model_name='fileattachment',
- name='type',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='partners.FileType'),
- ),
- migrations.AddField(
- model_name='actionpoint',
- name='trip',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='trips.Trip'),
- ),
- ]
diff --git a/EquiTrack/trips/migrations/0002_remove_linkedpartner_result.py b/EquiTrack/trips/migrations/0002_remove_linkedpartner_result.py
deleted file mode 100644
index b65858307..000000000
--- a/EquiTrack/trips/migrations/0002_remove_linkedpartner_result.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-27 17:16
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('trips', '0001_initial'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='linkedpartner',
- name='result',
- ),
- ]
diff --git a/EquiTrack/trips/migrations/0003_auto_20170112_2051.py b/EquiTrack/trips/migrations/0003_auto_20170112_2051.py
deleted file mode 100644
index 8af2463ca..000000000
--- a/EquiTrack/trips/migrations/0003_auto_20170112_2051.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-12 18:51
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('trips', '0002_remove_linkedpartner_result'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='triplocation',
- name='governorate',
- ),
- migrations.RemoveField(
- model_name='triplocation',
- name='locality',
- ),
- migrations.RemoveField(
- model_name='triplocation',
- name='region',
- ),
- ]
diff --git a/EquiTrack/trips/migrations/0004_auto_20170928_2215.py b/EquiTrack/trips/migrations/0004_auto_20170928_2215.py
deleted file mode 100644
index 7d7e78225..000000000
--- a/EquiTrack/trips/migrations/0004_auto_20170928_2215.py
+++ /dev/null
@@ -1,171 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-09-28 22:15
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('trips', '0003_auto_20170112_2051'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='actionpoint',
- name='person_responsible',
- ),
- migrations.RemoveField(
- model_name='actionpoint',
- name='trip',
- ),
- migrations.RemoveField(
- model_name='fileattachment',
- name='content_type',
- ),
- migrations.RemoveField(
- model_name='fileattachment',
- name='trip',
- ),
- migrations.RemoveField(
- model_name='fileattachment',
- name='type',
- ),
- migrations.RemoveField(
- model_name='linkedgovernmentpartner',
- name='intervention',
- ),
- migrations.RemoveField(
- model_name='linkedgovernmentpartner',
- name='partner',
- ),
- migrations.RemoveField(
- model_name='linkedgovernmentpartner',
- name='result',
- ),
- migrations.RemoveField(
- model_name='linkedgovernmentpartner',
- name='trip',
- ),
- migrations.RemoveField(
- model_name='linkedpartner',
- name='intervention',
- ),
- migrations.RemoveField(
- model_name='linkedpartner',
- name='partner',
- ),
- migrations.RemoveField(
- model_name='linkedpartner',
- name='trip',
- ),
- migrations.RemoveField(
- model_name='travelroutes',
- name='trip',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='budget_owner',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='driver',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='driver_supervisor',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='driver_trip',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='human_resources',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='office',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='owner',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='partners',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='pcas',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='programme_assistant',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='representative',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='section',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='supervisor',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='travel_assistant',
- ),
- migrations.RemoveField(
- model_name='trip',
- name='vision_approver',
- ),
- migrations.RemoveField(
- model_name='tripfunds',
- name='grant',
- ),
- migrations.RemoveField(
- model_name='tripfunds',
- name='trip',
- ),
- migrations.RemoveField(
- model_name='tripfunds',
- name='wbs',
- ),
- migrations.RemoveField(
- model_name='triplocation',
- name='location',
- ),
- migrations.RemoveField(
- model_name='triplocation',
- name='trip',
- ),
- migrations.DeleteModel(
- name='ActionPoint',
- ),
- migrations.DeleteModel(
- name='FileAttachment',
- ),
- migrations.DeleteModel(
- name='LinkedGovernmentPartner',
- ),
- migrations.DeleteModel(
- name='LinkedPartner',
- ),
- migrations.DeleteModel(
- name='TravelRoutes',
- ),
- migrations.DeleteModel(
- name='Trip',
- ),
- migrations.DeleteModel(
- name='TripFunds',
- ),
- migrations.DeleteModel(
- name='TripLocation',
- ),
- ]
diff --git a/EquiTrack/trips/migrations/__init__.py b/EquiTrack/trips/migrations/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/EquiTrack/trips/models.py b/EquiTrack/trips/models.py
deleted file mode 100644
index 9c9112fa5..000000000
--- a/EquiTrack/trips/models.py
+++ /dev/null
@@ -1,17 +0,0 @@
-from __future__ import absolute_import, division, print_function, unicode_literals
-
-# Models removed so that migration can run to drop the associated tables. Once
-# that migration has been run on production, this entire app can be deleted and
-# removed from INSTALLED_APPS.
-from django.db import connection
-from django.utils import six
-
-
-# get_report_filename() is used in the trips initial migration.
-def get_report_filename(instance, filename):
- return '/'.join([
- connection.schema_name,
- 'trip_reports',
- six.text_type(instance.trip.id),
- filename
- ])
diff --git a/EquiTrack/trips/tests/__init__.py b/EquiTrack/trips/tests/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/EquiTrack/users/migrations/0001_initial.py b/EquiTrack/users/migrations/0001_initial.py
index 95bb65e22..34041698d 100644
--- a/EquiTrack/users/migrations/0001_initial.py
+++ b/EquiTrack/users/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:22
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from decimal import Decimal
@@ -16,6 +16,7 @@ class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('publics', '0001_initial'),
]
operations = [
@@ -25,58 +26,85 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('domain_url', models.CharField(max_length=128, unique=True)),
('schema_name', models.CharField(max_length=63, unique=True, validators=[tenant_schemas.postgresql_backend.base._check_schema_name])),
- ('name', models.CharField(max_length=100)),
- ('country_short_code', models.CharField(blank=True, max_length=10, null=True)),
- ('business_area_code', models.CharField(blank=True, max_length=10, null=True)),
- ('latitude', models.DecimalField(blank=True, decimal_places=5, max_digits=8, null=True, validators=[django.core.validators.MinValueValidator(Decimal('-90')), django.core.validators.MaxValueValidator(Decimal('90'))])),
- ('longitude', models.DecimalField(blank=True, decimal_places=5, max_digits=8, null=True, validators=[django.core.validators.MinValueValidator(Decimal('-180')), django.core.validators.MaxValueValidator(Decimal('180'))])),
- ('initial_zoom', models.IntegerField(default=8)),
- ('vision_sync_enabled', models.BooleanField(default=True)),
- ('vision_last_synced', models.DateTimeField(blank=True, null=True)),
+ ('name', models.CharField(max_length=100, verbose_name='Name')),
+ ('country_short_code', models.CharField(blank=True, max_length=10, null=True, verbose_name='Short Code')),
+ ('long_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='Long Name')),
+ ('business_area_code', models.CharField(blank=True, max_length=10, null=True, verbose_name='Business Area Code')),
+ ('latitude', models.DecimalField(blank=True, decimal_places=5, max_digits=8, null=True, validators=[django.core.validators.MinValueValidator(Decimal('-90')), django.core.validators.MaxValueValidator(Decimal('90'))], verbose_name='Latitude')),
+ ('longitude', models.DecimalField(blank=True, decimal_places=5, max_digits=8, null=True, validators=[django.core.validators.MinValueValidator(Decimal('-180')), django.core.validators.MaxValueValidator(Decimal('180'))], verbose_name='Longitude')),
+ ('initial_zoom', models.IntegerField(default=8, verbose_name='Initial Zoom')),
+ ('vision_sync_enabled', models.BooleanField(default=True, verbose_name='Vision Sync Enabled')),
+ ('vision_last_synced', models.DateTimeField(blank=True, null=True, verbose_name='Vision Last Sync')),
+ ('threshold_tre_usd', models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True, verbose_name='Threshold TRE (USD)')),
+ ('threshold_tae_usd', models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True, verbose_name='Threshold TAE (USD)')),
+ ('local_currency', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='workspaces', to='publics.Currency', verbose_name='Local Currency')),
],
options={
- 'abstract': False,
+ 'ordering': ['name'],
+ 'verbose_name_plural': 'Countries',
},
),
migrations.CreateModel(
name='Office',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=254)),
- ('zonal_chief', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='offices', to=settings.AUTH_USER_MODEL, verbose_name='Chief')),
+ ('name', models.CharField(max_length=254, verbose_name='Name')),
+ ('zonal_chief', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='offices', to=settings.AUTH_USER_MODEL, verbose_name=b'Chief')),
],
+ options={
+ 'ordering': ('name',),
+ },
),
migrations.CreateModel(
name='Section',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=50, unique=True)),
+ ('name', models.CharField(max_length=64, unique=True, verbose_name='Name')),
+ ('code', models.CharField(blank=True, max_length=32, null=True, unique=True, verbose_name='Code')),
],
),
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('partner_staff_member', models.IntegerField(blank=True, null=True)),
- ('job_title', models.CharField(blank=True, max_length=255, null=True)),
- ('phone_number', models.CharField(blank=True, max_length=20, null=True)),
- ('installation_id', models.CharField(blank=True, max_length=50, null=True, verbose_name='Device ID')),
- ('countries_available', models.ManyToManyField(blank=True, related_name='accessible_by', to='users.Country')),
- ('country', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Country')),
- ('country_override', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='country_override', to='users.Country')),
- ('office', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Office')),
- ('section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Section')),
- ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
+ ('guid', models.CharField(max_length=40, null=True, unique=True, verbose_name='GUID')),
+ ('partner_staff_member', models.IntegerField(blank=True, null=True, verbose_name='Partner Staff Member')),
+ ('job_title', models.CharField(blank=True, max_length=255, null=True, verbose_name='Job Title')),
+ ('phone_number', models.CharField(blank=True, max_length=20, null=True, verbose_name='Phone Number')),
+ ('staff_id', models.CharField(blank=True, max_length=32, null=True, unique=True, verbose_name='Staff ID')),
+ ('org_unit_code', models.CharField(blank=True, max_length=32, null=True, verbose_name='Org Unit Code')),
+ ('org_unit_name', models.CharField(blank=True, max_length=64, null=True, verbose_name='Org Unit Name')),
+ ('post_number', models.CharField(blank=True, max_length=32, null=True, verbose_name='Post Number')),
+ ('post_title', models.CharField(blank=True, max_length=64, null=True, verbose_name='Post Title')),
+ ('vendor_number', models.CharField(blank=True, max_length=32, null=True, unique=True, verbose_name='Vendor Number')),
+ ('section_code', models.CharField(blank=True, max_length=32, null=True, verbose_name='Section Code')),
+ ('countries_available', models.ManyToManyField(blank=True, related_name='accessible_by', to='users.Country', verbose_name='Countries Available')),
+ ('country', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Country', verbose_name='Country')),
+ ('country_override', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='country_override', to='users.Country', verbose_name='Country Override')),
+ ('office', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Office', verbose_name='Office')),
+ ('oic', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='OIC')),
+ ('section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.Section', verbose_name='Section')),
+ ('supervisor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='supervisee', to=settings.AUTH_USER_MODEL, verbose_name='Supervisor')),
+ ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL, verbose_name='User')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='WorkspaceCounter',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('travel_reference_number_counter', models.PositiveIntegerField(default=1, verbose_name='Travel Reference Number Counter')),
+ ('travel_invoice_reference_number_counter', models.PositiveIntegerField(default=1, verbose_name='Travel Invoice Reference Number Counter')),
+ ('workspace', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='counters', to='users.Country', verbose_name='Workspace')),
],
),
migrations.AddField(
model_name='country',
name='offices',
- field=models.ManyToManyField(related_name='offices', to='users.Office'),
+ field=models.ManyToManyField(related_name='offices', to='users.Office', verbose_name='Offices'),
),
migrations.AddField(
model_name='country',
name='sections',
- field=models.ManyToManyField(related_name='sections', to='users.Section'),
+ field=models.ManyToManyField(related_name='sections', to='users.Section', verbose_name='Sections'),
),
]
diff --git a/EquiTrack/users/migrations/0002_userprofile_guid.py b/EquiTrack/users/migrations/0002_userprofile_guid.py
deleted file mode 100644
index de1799a05..000000000
--- a/EquiTrack/users/migrations/0002_userprofile_guid.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-27 21:02
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='userprofile',
- name='guid',
- field=models.CharField(max_length=40, null=True, unique=True),
- ),
- ]
diff --git a/EquiTrack/users/migrations/0003_auto_20170123_2009.py b/EquiTrack/users/migrations/0003_auto_20170123_2009.py
deleted file mode 100644
index 5bd92fb29..000000000
--- a/EquiTrack/users/migrations/0003_auto_20170123_2009.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-01-23 18:09
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0002_userprofile_guid'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='section',
- name='code',
- field=models.CharField(blank=True, max_length=32, null=True, unique=True),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='oic',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.UserProfile'),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='org_unit_code',
- field=models.CharField(blank=True, max_length=32, null=True),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='org_unit_name',
- field=models.CharField(blank=True, max_length=64, null=True),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='post_number',
- field=models.CharField(blank=True, max_length=32, null=True),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='post_title',
- field=models.CharField(blank=True, max_length=64, null=True),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='section_code',
- field=models.CharField(blank=True, max_length=32, null=True),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='staff_id',
- field=models.CharField(blank=True, max_length=32, null=True, unique=True),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='supervisor',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='supervisee', to='users.UserProfile'),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='vendor_number',
- field=models.CharField(blank=True, max_length=32, null=True, unique=True),
- ),
- migrations.AlterField(
- model_name='section',
- name='name',
- field=models.CharField(max_length=64, unique=True),
- ),
- ]
diff --git a/EquiTrack/users/migrations/0004_auto_20170201_1731.py b/EquiTrack/users/migrations/0004_auto_20170201_1731.py
deleted file mode 100644
index c5160b89f..000000000
--- a/EquiTrack/users/migrations/0004_auto_20170201_1731.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-01 15:31
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0003_auto_20170123_2009'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='country',
- name='threshold_tae_usd',
- field=models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True),
- ),
- migrations.AddField(
- model_name='country',
- name='threshold_tre_usd',
- field=models.DecimalField(decimal_places=4, default=None, max_digits=20, null=True),
- ),
- ]
diff --git a/EquiTrack/users/migrations/0005_auto_20170213_2117.py b/EquiTrack/users/migrations/0005_auto_20170213_2117.py
deleted file mode 100644
index 35191dfa6..000000000
--- a/EquiTrack/users/migrations/0005_auto_20170213_2117.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-13 19:17
-from __future__ import unicode_literals
-
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0004_auto_20170201_1731'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='userprofile',
- name='oic',
- ),
- migrations.RemoveField(
- model_name='userprofile',
- name='supervisor',
- ),
- migrations.AddField(
- model_name='userprofile',
- name='oic',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
- to=settings.AUTH_USER_MODEL),
- ),
- migrations.AddField(
- model_name='userprofile',
- name='supervisor',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
- related_name='supervisee', to=settings.AUTH_USER_MODEL),
- ),
- ]
diff --git a/EquiTrack/users/migrations/0006_country_local_currency.py b/EquiTrack/users/migrations/0006_country_local_currency.py
deleted file mode 100644
index 10725c744..000000000
--- a/EquiTrack/users/migrations/0006_country_local_currency.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-02-15 22:20
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('publics', '0005_auto_20170209_2353'),
- ('users', '0005_auto_20170213_2117'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='country',
- name='local_currency',
- field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='workspaces', to='publics.Currency'),
- ),
- ]
diff --git a/EquiTrack/users/migrations/0007_country_long_name.py b/EquiTrack/users/migrations/0007_country_long_name.py
deleted file mode 100644
index e6f6f4266..000000000
--- a/EquiTrack/users/migrations/0007_country_long_name.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-01 23:37
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-def reverse(apps, schema_editor):
- pass
-
-
-def country_short_to_long(apps, schema_editor):
- Country = apps.get_model('users', 'Country')
- for country in Country.objects.all():
- country.long_name = country.name
- country.save()
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0006_country_local_currency'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='country',
- name='long_name',
- field=models.CharField(blank=True, max_length=255, null=True),
- ),
- migrations.RunPython(
- country_short_to_long, reverse_code=reverse
- ),
-
- ]
diff --git a/EquiTrack/users/migrations/0008_workspacecounter.py b/EquiTrack/users/migrations/0008_workspacecounter.py
deleted file mode 100644
index 5080c060f..000000000
--- a/EquiTrack/users/migrations/0008_workspacecounter.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-03-10 10:57
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-def create_counters(apps, schema_editor):
- Workspace = apps.get_model('users', 'Country')
- WorkspaceCounter = apps.get_model('users', 'WorkspaceCounter')
-
- for workspace in Workspace.objects.all():
- WorkspaceCounter.objects.create(workspace=workspace)
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0007_country_long_name'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='WorkspaceCounter',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('travel_reference_number_counter', models.PositiveIntegerField(default=1)),
- ('travel_invoice_reference_number_counter', models.PositiveIntegerField(default=1)),
- ('workspace', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='counters', to='users.Country')),
- ],
- ),
- migrations.RunPython(create_counters),
- ]
diff --git a/EquiTrack/users/migrations/0009_remove_userprofile_installation_id.py b/EquiTrack/users/migrations/0009_remove_userprofile_installation_id.py
deleted file mode 100644
index 1cec84172..000000000
--- a/EquiTrack/users/migrations/0009_remove_userprofile_installation_id.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-22 17:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0008_workspacecounter'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='userprofile',
- name='installation_id',
- ),
- ]
diff --git a/EquiTrack/users/migrations/0010_auto_20171127_2158.py b/EquiTrack/users/migrations/0010_auto_20171127_2158.py
deleted file mode 100644
index beefc0eae..000000000
--- a/EquiTrack/users/migrations/0010_auto_20171127_2158.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-27 21:58
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0009_remove_userprofile_installation_id'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='country',
- options={'ordering': ['name']},
- ),
- ]
diff --git a/EquiTrack/users/migrations/0011_auto_20180309_1210.py b/EquiTrack/users/migrations/0011_auto_20180309_1210.py
deleted file mode 100644
index d50d91b5c..000000000
--- a/EquiTrack/users/migrations/0011_auto_20180309_1210.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-09 12:10
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0010_auto_20171127_2158'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='country',
- options={'ordering': ['name'], 'verbose_name_plural': 'Countries'},
- ),
- ]
diff --git a/EquiTrack/users/migrations/0012_auto_20180321_1830.py b/EquiTrack/users/migrations/0012_auto_20180321_1830.py
deleted file mode 100644
index 3f5aa5a33..000000000
--- a/EquiTrack/users/migrations/0012_auto_20180321_1830.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.8 on 2018-03-21 18:30
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('users', '0011_auto_20180309_1210'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='office',
- options={'ordering': ('name',)},
- ),
- ]
diff --git a/EquiTrack/users/models.py b/EquiTrack/users/models.py
index b38d55cd6..69e7c7eef 100644
--- a/EquiTrack/users/models.py
+++ b/EquiTrack/users/models.py
@@ -34,42 +34,40 @@ class Country(TenantMixin):
Relates to :model:`users.Section`
"""
- name = models.CharField(max_length=100)
+ name = models.CharField(max_length=100, verbose_name=_('Name'))
country_short_code = models.CharField(
max_length=10,
- null=True, blank=True
- )
- long_name = models.CharField(max_length=255, null=True, blank=True)
- business_area_code = models.CharField(
- max_length=10,
- null=True, blank=True
+ null=True, blank=True, verbose_name=_('Short Code')
)
+ long_name = models.CharField(max_length=255, null=True, blank=True, verbose_name=_('Long Name'))
+ business_area_code = models.CharField(max_length=10, null=True, blank=True, verbose_name=_('Business Area Code'))
latitude = models.DecimalField(
- null=True, blank=True,
- max_digits=8, decimal_places=5,
+ null=True, blank=True, verbose_name=_('Latitude'), max_digits=8, decimal_places=5,
validators=[MinValueValidator(Decimal(-90)), MaxValueValidator(Decimal(90))]
)
longitude = models.DecimalField(
- null=True, blank=True,
- max_digits=8, decimal_places=5,
+ null=True, blank=True, max_digits=8, decimal_places=5, verbose_name=_('Longitude'),
validators=[MinValueValidator(Decimal(-180)), MaxValueValidator(Decimal(180))]
)
- initial_zoom = models.IntegerField(default=8)
- vision_sync_enabled = models.BooleanField(default=True)
- vision_last_synced = models.DateTimeField(null=True, blank=True)
+ initial_zoom = models.IntegerField(default=8, verbose_name=_('Initial Zoom'))
+ vision_sync_enabled = models.BooleanField(default=True, verbose_name=_('Vision Sync Enabled'))
+ vision_last_synced = models.DateTimeField(null=True, blank=True, verbose_name=_('Vision Last Sync'))
local_currency = models.ForeignKey('publics.Currency',
+ verbose_name=_('Local Currency'),
related_name='workspaces',
null=True,
on_delete=models.SET_NULL,
blank=True)
# TODO: rename the related name as it's inappropriate for relating offices to countries.. should be office_countries
- offices = models.ManyToManyField('Office', related_name='offices')
- sections = models.ManyToManyField('Section', related_name='sections')
+ offices = models.ManyToManyField('Office', related_name='offices', verbose_name=_('Offices'))
+ sections = models.ManyToManyField('Section', related_name='sections', verbose_name=_('Sections'))
- threshold_tre_usd = models.DecimalField(max_digits=20, decimal_places=4, default=None, null=True)
- threshold_tae_usd = models.DecimalField(max_digits=20, decimal_places=4, default=None, null=True)
+ threshold_tre_usd = models.DecimalField(max_digits=20, decimal_places=4, default=None, null=True,
+ verbose_name=_('Threshold TRE (USD)'))
+ threshold_tae_usd = models.DecimalField(max_digits=20, decimal_places=4, default=None, null=True,
+ verbose_name=_('Threshold TAE (USD)'))
def __str__(self):
return self.name
@@ -84,11 +82,13 @@ class WorkspaceCounter(models.Model):
TRAVEL_REFERENCE = 'travel_reference_number_counter'
TRAVEL_INVOICE_REFERENCE = 'travel_invoice_reference_number_counter'
- workspace = models.OneToOneField('users.Country', related_name='counters')
+ workspace = models.OneToOneField('users.Country', related_name='counters', verbose_name=_('Workspace'))
# T2F travel reference number counter
- travel_reference_number_counter = models.PositiveIntegerField(default=1)
- travel_invoice_reference_number_counter = models.PositiveIntegerField(default=1)
+ travel_reference_number_counter = models.PositiveIntegerField(
+ default=1, verbose_name=_('Travel Reference Number Counter'))
+ travel_invoice_reference_number_counter = models.PositiveIntegerField(
+ default=1, verbose_name=_('Travel Invoice Reference Number Counter'))
def get_next_value(self, counter_type):
assert connection.in_atomic_block, 'Counters should be used only within an atomic block'
@@ -139,7 +139,7 @@ class Office(models.Model):
Relates to :model:`auth.User`
"""
- name = models.CharField(max_length=254)
+ name = models.CharField(max_length=254, verbose_name=_('Name'))
zonal_chief = models.ForeignKey(
settings.AUTH_USER_MODEL,
blank=True, null=True,
@@ -173,8 +173,8 @@ class Section(models.Model):
Represents a section for the country
"""
- name = models.CharField(max_length=64, unique=True)
- code = models.CharField(max_length=32, null=True, unique=True, blank=True)
+ name = models.CharField(max_length=64, unique=True, verbose_name=_('Name'))
+ code = models.CharField(max_length=32, null=True, unique=True, blank=True, verbose_name=_('Code'))
objects = CountrySectionManager()
@@ -198,35 +198,34 @@ class UserProfile(models.Model):
Relates to :model:`users.Office`
"""
- user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='profile')
+ user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='profile', verbose_name=_('User'))
# TODO: after migration remove the ability to add blank=True
- guid = models.CharField(max_length=40, unique=True, null=True)
-
- partner_staff_member = models.IntegerField(
- null=True,
- blank=True
- )
- country = models.ForeignKey(Country, null=True, blank=True)
- country_override = models.ForeignKey(Country, null=True, blank=True, related_name="country_override")
- countries_available = models.ManyToManyField(Country, blank=True, related_name="accessible_by")
- section = models.ForeignKey(Section, null=True, blank=True)
- office = models.ForeignKey(Office, null=True, blank=True)
- job_title = models.CharField(max_length=255, null=True, blank=True)
- phone_number = models.CharField(max_length=20, null=True, blank=True)
-
- staff_id = models.CharField(max_length=32, null=True, blank=True, unique=True)
- org_unit_code = models.CharField(max_length=32, null=True, blank=True)
- org_unit_name = models.CharField(max_length=64, null=True, blank=True)
- post_number = models.CharField(max_length=32, null=True, blank=True)
- post_title = models.CharField(max_length=64, null=True, blank=True)
- vendor_number = models.CharField(max_length=32, null=True, blank=True, unique=True)
+ guid = models.CharField(max_length=40, unique=True, null=True, verbose_name=_('GUID'))
+
+ partner_staff_member = models.IntegerField(null=True, blank=True, verbose_name=_('Partner Staff Member'))
+ country = models.ForeignKey(Country, null=True, blank=True, verbose_name=_('Country'))
+ country_override = models.ForeignKey(Country, null=True, blank=True, related_name="country_override",
+ verbose_name=_('Country Override'))
+ countries_available = models.ManyToManyField(Country, blank=True, related_name="accessible_by",
+ verbose_name=_('Countries Available'))
+ section = models.ForeignKey(Section, null=True, blank=True, verbose_name=_('Section'))
+ office = models.ForeignKey(Office, null=True, blank=True, verbose_name=_('Office'))
+ job_title = models.CharField(max_length=255, null=True, blank=True, verbose_name=_('Job Title'))
+ phone_number = models.CharField(max_length=20, null=True, blank=True, verbose_name=_('Phone Number'))
+
+ staff_id = models.CharField(max_length=32, null=True, blank=True, unique=True, verbose_name=_('Staff ID'))
+ org_unit_code = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Org Unit Code'))
+ org_unit_name = models.CharField(max_length=64, null=True, blank=True, verbose_name=_('Org Unit Name'))
+ post_number = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Post Number'))
+ post_title = models.CharField(max_length=64, null=True, blank=True, verbose_name=_('Post Title'))
+ vendor_number = models.CharField(max_length=32, null=True, blank=True, unique=True, verbose_name=_('Vendor Number'))
supervisor = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='supervisee', on_delete=models.SET_NULL,
- blank=True, null=True)
- oic = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL,
+ blank=True, null=True, verbose_name=_('Supervisor'))
+ oic = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, verbose_name=_('OIC'),
null=True, blank=True) # related oic_set
# TODO: refactor when sections are properly set
- section_code = models.CharField(max_length=32, null=True, blank=True)
+ section_code = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Section Code'))
# TODO: figure this out when we need to autmatically map to groups
# vision_roles = ArrayField(models.CharField(max_length=20, blank=True, choices=VISION_ROLES),
diff --git a/EquiTrack/utils/permissions/models/models.py b/EquiTrack/utils/permissions/models/models.py
index 855f743af..d050a4d4b 100644
--- a/EquiTrack/utils/permissions/models/models.py
+++ b/EquiTrack/utils/permissions/models/models.py
@@ -2,6 +2,7 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+from django.utils.translation import ugettext as _
from model_utils import Choices
@@ -74,7 +75,7 @@ class StatusBasePermission(BasePermission):
('new', 'New instance'),
)
- instance_status = models.CharField(max_length=32)
+ instance_status = models.CharField(max_length=32, verbose_name=_('Instance Status'))
objects = StatusBasePermissionQueryset.as_manager()
diff --git a/EquiTrack/vision/migrations/0001_initial.py b/EquiTrack/vision/migrations/0001_initial.py
index 9c670d25b..189c49f6e 100644
--- a/EquiTrack/vision/migrations/0001_initial.py
+++ b/EquiTrack/vision/migrations/0001_initial.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:23
+# Generated by Django 1.10.8 on 2018-03-26 16:05
from __future__ import unicode_literals
from django.db import migrations, models
@@ -19,13 +19,14 @@ class Migration(migrations.Migration):
name='VisionSyncLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('handler_name', models.CharField(max_length=50)),
- ('total_records', models.IntegerField(default=0)),
- ('total_processed', models.IntegerField(default=0)),
- ('successful', models.BooleanField(default=False)),
- ('exception_message', models.TextField(blank=True, null=True)),
- ('date_processed', models.DateTimeField(auto_now=True)),
- ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Country')),
+ ('handler_name', models.CharField(max_length=50, verbose_name='Handler Name')),
+ ('total_records', models.IntegerField(default=0, verbose_name='Total Records')),
+ ('total_processed', models.IntegerField(default=0, verbose_name='Total Processed')),
+ ('successful', models.BooleanField(default=False, verbose_name='Successful')),
+ ('details', models.CharField(blank=True, max_length=2048, null=True, verbose_name='Details')),
+ ('exception_message', models.TextField(blank=True, null=True, verbose_name='Exception Message')),
+ ('date_processed', models.DateTimeField(auto_now=True, verbose_name='Date Processed')),
+ ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Country', verbose_name='Country')),
],
),
]
diff --git a/EquiTrack/vision/migrations/0002_visionsynclog_details.py b/EquiTrack/vision/migrations/0002_visionsynclog_details.py
deleted file mode 100644
index 07236fbd1..000000000
--- a/EquiTrack/vision/migrations/0002_visionsynclog_details.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-06-05 21:26
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('vision', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='visionsynclog',
- name='details',
- field=models.CharField(blank=True, max_length=2048, null=True),
- ),
- ]
diff --git a/EquiTrack/vision/models.py b/EquiTrack/vision/models.py
index 36529f984..3acf778d2 100644
--- a/EquiTrack/vision/models.py
+++ b/EquiTrack/vision/models.py
@@ -1,6 +1,6 @@
-
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+from django.utils.translation import ugettext_lazy as _
from users.models import Country
@@ -13,14 +13,14 @@ class VisionSyncLog(models.Model):
Relates to :model:`users.Country`
"""
- country = models.ForeignKey(Country)
- handler_name = models.CharField(max_length=50)
- total_records = models.IntegerField(default=0)
- total_processed = models.IntegerField(default=0)
- successful = models.BooleanField(default=False)
- details = models.CharField(max_length=2048, blank=True, null=True)
- exception_message = models.TextField(blank=True, null=True)
- date_processed = models.DateTimeField(auto_now=True)
+ country = models.ForeignKey(Country, verbose_name=_('Country'))
+ handler_name = models.CharField(max_length=50, verbose_name=_('Handler Name'))
+ total_records = models.IntegerField(default=0, verbose_name=_('Total Records'))
+ total_processed = models.IntegerField(default=0, verbose_name=_('Total Processed'))
+ successful = models.BooleanField(default=False, verbose_name=_('Successful'))
+ details = models.CharField(max_length=2048, blank=True, null=True, verbose_name=_('Details'))
+ exception_message = models.TextField(blank=True, null=True, verbose_name=_('Exception Message'))
+ date_processed = models.DateTimeField(auto_now=True, verbose_name=_('Date Processed'))
def __str__(self):
return u'{0.country} {0.date_processed}:{0.successful} {0.total_processed}'.format(self)
diff --git a/EquiTrack/workplan/__init__.py b/EquiTrack/workplan/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/EquiTrack/workplan/migrations/0001_initial.py b/EquiTrack/workplan/migrations/0001_initial.py
deleted file mode 100644
index 58197b4b5..000000000
--- a/EquiTrack/workplan/migrations/0001_initial.py
+++ /dev/null
@@ -1,134 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-11-09 22:23
-from __future__ import unicode_literals
-
-from django.conf import settings
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations, models
-import django.db.models.deletion
-import django.utils.timezone
-import model_utils.fields
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ('reports', '0001_initial'),
- ('users', '0001_initial'),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ('locations', '0001_initial'),
- ('partners', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='Comment',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
- ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
- ('text', models.TextField()),
- ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to=settings.AUTH_USER_MODEL)),
- ('tagged_users', models.ManyToManyField(blank=True, related_name='_comment_tagged_users_+', to=settings.AUTH_USER_MODEL)),
- ],
- options={
- 'abstract': False,
- },
- ),
- migrations.CreateModel(
- name='CoverPage',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('national_priority', models.CharField(max_length=255)),
- ('responsible_government_entity', models.CharField(max_length=255)),
- ('planning_assumptions', models.TextField()),
- ('logo', models.ImageField(blank=True, height_field='logo_height', null=True, upload_to='', width_field='logo_width')),
- ],
- ),
- migrations.CreateModel(
- name='CoverPageBudget',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('from_date', models.DateField()),
- ('to_date', models.DateField()),
- ('total_amount', models.CharField(max_length=64)),
- ('funded_amount', models.CharField(max_length=64)),
- ('unfunded_amount', models.CharField(max_length=64)),
- ('cover_page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='budgets', to='workplan.CoverPage')),
- ],
- ),
- migrations.CreateModel(
- name='Label',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=32, unique=True)),
- ],
- ),
- migrations.CreateModel(
- name='Quarter',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(max_length=64)),
- ('start_date', models.DateTimeField()),
- ('end_date', models.DateTimeField()),
- ],
- ),
- migrations.CreateModel(
- name='ResultWorkplanProperty',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('assumptions', models.TextField(blank=True, null=True)),
- ('status', models.CharField(blank=True, choices=[('On Track', 'On Track'), ('Constrained', 'Constrained'), ('No Progress', 'No Progress'), ('Target Met', 'Target Met')], max_length=255, null=True)),
- ('prioritized', models.BooleanField(default=False)),
- ('metadata', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
- ('other_partners', models.CharField(blank=True, max_length=2048, null=True)),
- ('rr_funds', models.PositiveIntegerField(blank=True, null=True)),
- ('or_funds', models.PositiveIntegerField(blank=True, null=True)),
- ('ore_funds', models.PositiveIntegerField(blank=True, null=True)),
- ('total_funds', models.PositiveIntegerField(blank=True, null=True)),
- ('geotag', models.ManyToManyField(related_name='_resultworkplanproperty_geotag_+', to='locations.Location')),
- ('labels', models.ManyToManyField(to='workplan.Label')),
- ('partners', models.ManyToManyField(related_name='_resultworkplanproperty_partners_+', to='partners.PartnerOrganization')),
- ('responsible_persons', models.ManyToManyField(related_name='_resultworkplanproperty_responsible_persons_+', to=settings.AUTH_USER_MODEL)),
- ('result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='workplan_properties', to='reports.Result')),
- ('sections', models.ManyToManyField(related_name='_resultworkplanproperty_sections_+', to='users.Section')),
- ],
- ),
- migrations.CreateModel(
- name='Workplan',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('status', models.CharField(blank=True, choices=[('On Track', 'On Track'), ('Constrained', 'Constrained'), ('No Progress', 'No Progress'), ('Target Met', 'Target Met')], max_length=32, null=True)),
- ('country_programme', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='reports.CountryProgramme')),
- ],
- ),
- migrations.CreateModel(
- name='WorkplanProject',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('workplan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='workplan_projects', to='workplan.Workplan')),
- ],
- ),
- migrations.AddField(
- model_name='resultworkplanproperty',
- name='workplan',
- field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='workplan.Workplan'),
- ),
- migrations.AddField(
- model_name='quarter',
- name='workplan',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quarters', to='workplan.Workplan'),
- ),
- migrations.AddField(
- model_name='coverpage',
- name='workplan_project',
- field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='cover_page', to='workplan.WorkplanProject'),
- ),
- migrations.AddField(
- model_name='comment',
- name='workplan',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='workplan.Workplan'),
- ),
- ]
diff --git a/EquiTrack/workplan/migrations/0002_milestone.py b/EquiTrack/workplan/migrations/0002_milestone.py
deleted file mode 100644
index c9f796dcd..000000000
--- a/EquiTrack/workplan/migrations/0002_milestone.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2016-12-09 18:30
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('workplan', '0001_initial'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='Milestone',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('description', models.TextField()),
- ('assumptions', models.TextField(blank=True, null=True)),
- ('result_wp_property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='milestones', to='workplan.ResultWorkplanProperty')),
- ],
- ),
- ]
diff --git a/EquiTrack/workplan/migrations/0003_auto_20171127_2209.py b/EquiTrack/workplan/migrations/0003_auto_20171127_2209.py
deleted file mode 100644
index 353803fa2..000000000
--- a/EquiTrack/workplan/migrations/0003_auto_20171127_2209.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.9.10 on 2017-11-27 22:09
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('workplan', '0002_milestone'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='comment',
- name='author',
- ),
- migrations.RemoveField(
- model_name='comment',
- name='tagged_users',
- ),
- migrations.RemoveField(
- model_name='comment',
- name='workplan',
- ),
- migrations.RemoveField(
- model_name='coverpage',
- name='workplan_project',
- ),
- migrations.RemoveField(
- model_name='coverpagebudget',
- name='cover_page',
- ),
- migrations.RemoveField(
- model_name='milestone',
- name='result_wp_property',
- ),
- migrations.RemoveField(
- model_name='quarter',
- name='workplan',
- ),
- migrations.RemoveField(
- model_name='resultworkplanproperty',
- name='geotag',
- ),
- migrations.RemoveField(
- model_name='resultworkplanproperty',
- name='labels',
- ),
- migrations.RemoveField(
- model_name='resultworkplanproperty',
- name='partners',
- ),
- migrations.RemoveField(
- model_name='resultworkplanproperty',
- name='responsible_persons',
- ),
- migrations.RemoveField(
- model_name='resultworkplanproperty',
- name='result',
- ),
- migrations.RemoveField(
- model_name='resultworkplanproperty',
- name='sections',
- ),
- migrations.RemoveField(
- model_name='resultworkplanproperty',
- name='workplan',
- ),
- migrations.RemoveField(
- model_name='workplan',
- name='country_programme',
- ),
- migrations.RemoveField(
- model_name='workplanproject',
- name='workplan',
- ),
- migrations.DeleteModel(
- name='Comment',
- ),
- migrations.DeleteModel(
- name='CoverPage',
- ),
- migrations.DeleteModel(
- name='CoverPageBudget',
- ),
- migrations.DeleteModel(
- name='Label',
- ),
- migrations.DeleteModel(
- name='Milestone',
- ),
- migrations.DeleteModel(
- name='Quarter',
- ),
- migrations.DeleteModel(
- name='ResultWorkplanProperty',
- ),
- migrations.DeleteModel(
- name='Workplan',
- ),
- migrations.DeleteModel(
- name='WorkplanProject',
- ),
- ]
diff --git a/EquiTrack/workplan/migrations/__init__.py b/EquiTrack/workplan/migrations/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/EquiTrack/workplan/models.py b/EquiTrack/workplan/models.py
deleted file mode 100644
index e7251270a..000000000
--- a/EquiTrack/workplan/models.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Models removed so that migration can run to drop the associated tables. Once
-# that migration has been run on production, this entire app can be deleted and
-# removed from INSTALLED_APPS.