diff --git a/finances/constants.py b/finances/constants.py index b700a6f0432f14d9a2b65203fdd145b9e4fff95e..5c2d63d1a4b7e0a57dec6b4772fb0a2a92d44b55 100644 --- a/finances/constants.py +++ b/finances/constants.py @@ -5,14 +5,19 @@ __license__ = "AGPL v3" import datetime -SUBSIDY_TYPE_GRANT = 'grant' -SUBSIDY_TYPE_PARTNERAGREEMENT = 'partneragreement' +SUBSIDY_TYPE_SPONSORSHIPAGREEMENT = 'sponsorshipagreement' +SUBSIDY_TYPE_INCIDENTALGRANT = 'incidentalgrant' +SUBSIDY_TYPE_DEVELOPMENTGRANT = 'developmentgrant' SUBSIDY_TYPE_COLLABORATION = 'collaborationagreement' +SUBSIDY_TYPE_DONATION = 'donation' + SUBSIDY_TYPES = ( - (SUBSIDY_TYPE_GRANT, 'Grant'), - (SUBSIDY_TYPE_PARTNERAGREEMENT, 'Partner Agreement'), + (SUBSIDY_TYPE_SPONSORSHIPAGREEMENT, 'Sponsorship Agreement'), + (SUBSIDY_TYPE_INCIDENTALGRANT, 'Incidental Grant'), + (SUBSIDY_TYPE_DEVELOPMENTGRANT, 'Development Grant'), (SUBSIDY_TYPE_COLLABORATION, 'Collaboration Agreement'), + (SUBSIDY_TYPE_DONATION, 'Donation'), ) diff --git a/finances/migrations/0009_auto_20190214_0202.py b/finances/migrations/0009_auto_20190214_0202.py new file mode 100644 index 0000000000000000000000000000000000000000..753137c47d7d4bf4b836cbb9662715f2b1bece7e --- /dev/null +++ b/finances/migrations/0009_auto_20190214_0202.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2019-02-14 01:02 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('finances', '0008_subsidy_amount_publicly_shown'), + ] + + operations = [ + migrations.AlterField( + model_name='subsidy', + name='subsidy_type', + field=models.CharField(choices=[('sponsorshipagreement', 'Sponsorship Agreement'), ('incidentalgrant', 'Incidental Grant'), ('developmentgrant', 'Development Grant'), ('collaborationagreement', 'Collaboration Agreement'), ('donation', 'Donation'), ('grant', 'Grant'), ('partneragreement', 'Partner Agreement')], max_length=256), + ), + ] diff --git a/finances/migrations/0010_updatesubsidytypes.py b/finances/migrations/0010_updatesubsidytypes.py new file mode 100644 index 0000000000000000000000000000000000000000..6088e5d3b1457539d5e65dd70c56b8d7e54aa6f2 --- /dev/null +++ b/finances/migrations/0010_updatesubsidytypes.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2019-02-14 01:04 +from __future__ import unicode_literals + +from django.db import migrations + +from finances.constants import SUBSIDY_TYPE_SPONSORSHIPAGREEMENT, SUBSIDY_TYPE_INCIDENTALGRANT + +def update_subsidy_types(apps, schema_editor): + Subsidy = apps.get_model('finances', 'Subsidy') + + Subsidy.objects.filter(subsidy_type='grant').update( + subsidy_type=SUBSIDY_TYPE_INCIDENTALGRANT) + Subsidy.objects.filter(subsidy_type='partneragreement').update( + subsidy_type=SUBSIDY_TYPE_SPONSORSHIPAGREEMENT) + + +class Migration(migrations.Migration): + + dependencies = [ + ('finances', '0009_auto_20190214_0202'), + ] + + operations = [ + migrations.RunPython(update_subsidy_types, + reverse_code=migrations.RunPython.noop), + ] diff --git a/finances/migrations/0011_auto_20190214_0224.py b/finances/migrations/0011_auto_20190214_0224.py new file mode 100644 index 0000000000000000000000000000000000000000..bdbb8e1cde12be795dd4780b36ec7f9a3b56102e --- /dev/null +++ b/finances/migrations/0011_auto_20190214_0224.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2019-02-14 01:24 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('finances', '0010_updatesubsidytypes'), + ] + + operations = [ + migrations.AlterField( + model_name='subsidy', + name='subsidy_type', + field=models.CharField(choices=[('sponsorshipagreement', 'Sponsorship Agreement'), ('incidentalgrant', 'Incidental Grant'), ('developmentgrant', 'Development Grant'), ('collaborationagreement', 'Collaboration Agreement'), ('donation', 'Donation')], max_length=256), + ), + ] diff --git a/finances/models.py b/finances/models.py index 7cc8f07076ea1b0b4e15875a0421e7810ae5b841..4c2a85bc179e555a9421e14cb23fb8dda8246fbd 100644 --- a/finances/models.py +++ b/finances/models.py @@ -21,7 +21,7 @@ class Subsidy(models.Model): to a corresponding Subsidy instance. This can for example be: - - a Partners agreement + - a Sponsorship agreement - an incidental grant - a development grant for a specific purpose - a Collaboration Agreement