We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
IATI import
## Test plan
1. Take any IATI file from the [IATI registry](http://iatiregistry.org)
2. Make sure the reporting organisation is in RSR, with the correct IATI Organisation ID and 'Reportable' set to True.
3. In the old admin, add a new IATI import. Either fill in an external URL, or a local file. The user that is selected will get an email with a summary of the import. _Note that for larger files (e.g. > 100 projects), you might see a timeout. However, the import should continue to run in the background._
4. When the import is done, it should show up with status completed, and the mail with import details should have been sent. _Note that files up to 100 projects take about half a minute._
## Issue description

See product design repository: https://github.com/akvo/akvo-product-design/issues/97


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `akvo/rsr/migrations/0032_auto_20151001_0956.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
3 
4 from django.db import models, migrations
5 import akvo.rsr.models.iati_import
6 from django.conf import settings
7 import akvo.rsr.fields
8 
9 
10 class Migration(migrations.Migration):
11 
12     dependencies = [
13         ('rsr', '0031_auto_20150825_1109'),
14     ]
15 
16     operations = [
17         migrations.CreateModel(
18             name='IatiImport',
19             fields=[
20                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
21                 ('url', models.URLField(verbose_name='url', blank=True)),
22                 ('local_file', models.FileField(upload_to=akvo.rsr.models.iati_import.file_path, verbose_name='local file', blank=True)),
23                 ('status', models.PositiveSmallIntegerField(default=1, verbose_name='status', choices=[(1, 'pending'), (2, 'retrieving file'), (3, 'import in progress'), (4, 'completed'), (5, 'cancelled')])),
24                 ('start_date', models.DateTimeField(null=True, verbose_name='start date', blank=True)),
25                 ('end_date', models.DateTimeField(null=True, verbose_name='end date', blank=True)),
26             ],
27             options={
28                 'verbose_name': 'IATI import',
29                 'verbose_name_plural': 'IATI imports',
30             },
31             bases=(models.Model,),
32         ),
33         migrations.CreateModel(
34             name='IatiImportLog',
35             fields=[
36                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
37                 ('severity', models.PositiveSmallIntegerField(default=1, verbose_name='severity', choices=[(0, 'information'), (1, 'critical error'), (2, 'value not saved'), (3, 'value partly saved')])),
38                 ('text', akvo.rsr.fields.ValidXMLTextField(verbose_name='text')),
39                 ('iati_import', models.ForeignKey(related_name='iati_import_logs', verbose_name='iati_import', to='rsr.IatiImport')),
40                 ('project', models.ForeignKey(related_name='iati_project_import_logs', verbose_name='project', blank=True, to='rsr.Project', null=True)),
41             ],
42             options={
43                 'verbose_name': 'IATI import log',
44                 'verbose_name_plural': 'IATI import logs',
45             },
46             bases=(models.Model,),
47         ),
48         migrations.CreateModel(
49             name='IatiProjectImport',
50             fields=[
51                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
52                 ('action', models.PositiveSmallIntegerField(verbose_name='action', choices=[(1, 'create'), (2, 'update')])),
53                 ('status', models.PositiveSmallIntegerField(default=1, verbose_name='status', choices=[(1, 'pending'), (2, 'import in progress'), (3, 'completed'), (4, 'cancelled')])),
54                 ('start_date', models.DateTimeField(null=True, verbose_name='start date', blank=True)),
55                 ('end_date', models.DateTimeField(null=True, verbose_name='end date', blank=True)),
56                 ('iati_import', models.ForeignKey(related_name='iati_project_imports', verbose_name='iati_import', to='rsr.IatiImport')),
57                 ('project', models.ForeignKey(related_name='iati_project_imports', verbose_name='project', to='rsr.Project')),
58             ],
59             options={
60                 'verbose_name': 'IATI project import',
61                 'verbose_name_plural': 'IATI project imports',
62             },
63             bases=(models.Model,),
64         ),
65         migrations.AddField(
66             model_name='iatiimport',
67             name='projects',
68             field=models.ManyToManyField(to='rsr.Project', verbose_name='projects', through='rsr.IatiProjectImport', blank=True),
69             preserve_default=True,
70         ),
71         migrations.AddField(
72             model_name='iatiimport',
73             name='user',
74             field=models.ForeignKey(related_name='iati_imports', verbose_name='user', to=settings.AUTH_USER_MODEL),
75             preserve_default=True,
76         ),
77         migrations.AlterField(
78             model_name='budgetitem',
79             name='amount',
80             field=models.DecimalField(null=True, verbose_name='amount', max_digits=14, decimal_places=2, blank=True),
81             preserve_default=True,
82         ),
83         migrations.AlterField(
84             model_name='partnership',
85             name='funding_amount',
86             field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text="The funding amount of the partner.<br>Note that it's only possible to indicate a funding amount for funding partners.", null=True, verbose_name='funding amount', db_index=True),
87             preserve_default=True,
88         ),
89         migrations.AlterField(
90             model_name='planneddisbursement',
91             name='value',
92             field=models.DecimalField(null=True, verbose_name='value', max_digits=14, decimal_places=2, blank=True),
93             preserve_default=True,
94         ),
95         migrations.AlterField(
96             model_name='project',
97             name='budget',
98             field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, verbose_name='project budget', db_index=True),
99             preserve_default=True,
100         ),
101         migrations.AlterField(
102             model_name='project',
103             name='funds',
104             field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, db_index=True),
105             preserve_default=True,
106         ),
107         migrations.AlterField(
108             model_name='project',
109             name='funds_needed',
110             field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, db_index=True),
111             preserve_default=True,
112         ),
113         migrations.AlterField(
114             model_name='transaction',
115             name='value',
116             field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text='Enter the transaction amount.', null=True, verbose_name='value'),
117             preserve_default=True,
118         ),
119     ]
120
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/akvo/rsr/migrations/0032_auto_20151001_0956.py b/akvo/rsr/migrations/0032_auto_20151001_0956.py
--- a/akvo/rsr/migrations/0032_auto_20151001_0956.py
+++ b/akvo/rsr/migrations/0032_auto_20151001_0956.py
@@ -116,4 +116,10 @@
             field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text='Enter the transaction amount.', null=True, verbose_name='value'),
             preserve_default=True,
         ),
+        migrations.AlterField(
+            model_name='project',
+            name='iati_activity_id',
+            field=akvo.rsr.fields.ValidXMLCharField(null=True, max_length=100, blank=True, help_text='This should be the official unique IATI Identifier for the project. The identifier consists of the IATI organisation identifier and the (organisations internal) project identifier, e.g. NL-KVK-31156201-TZ1234. (100 characters)<br>Note that \'projects\' in this form are the same as \'activities\' in IATI.<br><a href="http://iatistandard.org/activity-standard/iati-activities/iati-activity/iati-identifier" target="_blank">How to create</a>', verbose_name='IATI Project Identifier', db_index=True),
+            preserve_default=True,
+        ),
     ]

{"golden_diff": "diff --git a/akvo/rsr/migrations/0032_auto_20151001_0956.py b/akvo/rsr/migrations/0032_auto_20151001_0956.py\n--- a/akvo/rsr/migrations/0032_auto_20151001_0956.py\n+++ b/akvo/rsr/migrations/0032_auto_20151001_0956.py\n@@ -116,4 +116,10 @@\n             field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text='Enter the transaction amount.', null=True, verbose_name='value'),\n             preserve_default=True,\n         ),\n+        migrations.AlterField(\n+            model_name='project',\n+            name='iati_activity_id',\n+            field=akvo.rsr.fields.ValidXMLCharField(null=True, max_length=100, blank=True, help_text='This should be the official unique IATI Identifier for the project. The identifier consists of the IATI organisation identifier and the (organisations internal) project identifier, e.g. NL-KVK-31156201-TZ1234. (100 characters)<br>Note that \\'projects\\' in this form are the same as \\'activities\\' in IATI.<br><a href=\"http://iatistandard.org/activity-standard/iati-activities/iati-activity/iati-identifier\" target=\"_blank\">How to create</a>', verbose_name='IATI Project Identifier', db_index=True),\n+            preserve_default=True,\n+        ),\n     ]\n", "issue": "IATI import\n## Test plan\n1. Take any IATI file from the [IATI registry](http://iatiregistry.org)\n2. Make sure the reporting organisation is in RSR, with the correct IATI Organisation ID and 'Reportable' set to True.\n3. In the old admin, add a new IATI import. Either fill in an external URL, or a local file. The user that is selected will get an email with a summary of the import. _Note that for larger files (e.g. > 100 projects), you might see a timeout. However, the import should continue to run in the background._\n4. When the import is done, it should show up with status completed, and the mail with import details should have been sent. _Note that files up to 100 projects take about half a minute._\n## Issue description\n\nSee product design repository: https://github.com/akvo/akvo-product-design/issues/97\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport akvo.rsr.models.iati_import\nfrom django.conf import settings\nimport akvo.rsr.fields\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('rsr', '0031_auto_20150825_1109'),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='IatiImport',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('url', models.URLField(verbose_name='url', blank=True)),\n                ('local_file', models.FileField(upload_to=akvo.rsr.models.iati_import.file_path, verbose_name='local file', blank=True)),\n                ('status', models.PositiveSmallIntegerField(default=1, verbose_name='status', choices=[(1, 'pending'), (2, 'retrieving file'), (3, 'import in progress'), (4, 'completed'), (5, 'cancelled')])),\n                ('start_date', models.DateTimeField(null=True, verbose_name='start date', blank=True)),\n                ('end_date', models.DateTimeField(null=True, verbose_name='end date', blank=True)),\n            ],\n            options={\n                'verbose_name': 'IATI import',\n                'verbose_name_plural': 'IATI imports',\n            },\n            bases=(models.Model,),\n        ),\n        migrations.CreateModel(\n            name='IatiImportLog',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('severity', models.PositiveSmallIntegerField(default=1, verbose_name='severity', choices=[(0, 'information'), (1, 'critical error'), (2, 'value not saved'), (3, 'value partly saved')])),\n                ('text', akvo.rsr.fields.ValidXMLTextField(verbose_name='text')),\n                ('iati_import', models.ForeignKey(related_name='iati_import_logs', verbose_name='iati_import', to='rsr.IatiImport')),\n                ('project', models.ForeignKey(related_name='iati_project_import_logs', verbose_name='project', blank=True, to='rsr.Project', null=True)),\n            ],\n            options={\n                'verbose_name': 'IATI import log',\n                'verbose_name_plural': 'IATI import logs',\n            },\n            bases=(models.Model,),\n        ),\n        migrations.CreateModel(\n            name='IatiProjectImport',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('action', models.PositiveSmallIntegerField(verbose_name='action', choices=[(1, 'create'), (2, 'update')])),\n                ('status', models.PositiveSmallIntegerField(default=1, verbose_name='status', choices=[(1, 'pending'), (2, 'import in progress'), (3, 'completed'), (4, 'cancelled')])),\n                ('start_date', models.DateTimeField(null=True, verbose_name='start date', blank=True)),\n                ('end_date', models.DateTimeField(null=True, verbose_name='end date', blank=True)),\n                ('iati_import', models.ForeignKey(related_name='iati_project_imports', verbose_name='iati_import', to='rsr.IatiImport')),\n                ('project', models.ForeignKey(related_name='iati_project_imports', verbose_name='project', to='rsr.Project')),\n            ],\n            options={\n                'verbose_name': 'IATI project import',\n                'verbose_name_plural': 'IATI project imports',\n            },\n            bases=(models.Model,),\n        ),\n        migrations.AddField(\n            model_name='iatiimport',\n            name='projects',\n            field=models.ManyToManyField(to='rsr.Project', verbose_name='projects', through='rsr.IatiProjectImport', blank=True),\n            preserve_default=True,\n        ),\n        migrations.AddField(\n            model_name='iatiimport',\n            name='user',\n            field=models.ForeignKey(related_name='iati_imports', verbose_name='user', to=settings.AUTH_USER_MODEL),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='budgetitem',\n            name='amount',\n            field=models.DecimalField(null=True, verbose_name='amount', max_digits=14, decimal_places=2, blank=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='partnership',\n            name='funding_amount',\n            field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text=\"The funding amount of the partner.<br>Note that it's only possible to indicate a funding amount for funding partners.\", null=True, verbose_name='funding amount', db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='planneddisbursement',\n            name='value',\n            field=models.DecimalField(null=True, verbose_name='value', max_digits=14, decimal_places=2, blank=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='project',\n            name='budget',\n            field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, verbose_name='project budget', db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='project',\n            name='funds',\n            field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='project',\n            name='funds_needed',\n            field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='transaction',\n            name='value',\n            field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text='Enter the transaction amount.', null=True, verbose_name='value'),\n            preserve_default=True,\n        ),\n    ]\n", "path": "akvo/rsr/migrations/0032_auto_20151001_0956.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport akvo.rsr.models.iati_import\nfrom django.conf import settings\nimport akvo.rsr.fields\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('rsr', '0031_auto_20150825_1109'),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='IatiImport',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('url', models.URLField(verbose_name='url', blank=True)),\n                ('local_file', models.FileField(upload_to=akvo.rsr.models.iati_import.file_path, verbose_name='local file', blank=True)),\n                ('status', models.PositiveSmallIntegerField(default=1, verbose_name='status', choices=[(1, 'pending'), (2, 'retrieving file'), (3, 'import in progress'), (4, 'completed'), (5, 'cancelled')])),\n                ('start_date', models.DateTimeField(null=True, verbose_name='start date', blank=True)),\n                ('end_date', models.DateTimeField(null=True, verbose_name='end date', blank=True)),\n            ],\n            options={\n                'verbose_name': 'IATI import',\n                'verbose_name_plural': 'IATI imports',\n            },\n            bases=(models.Model,),\n        ),\n        migrations.CreateModel(\n            name='IatiImportLog',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('severity', models.PositiveSmallIntegerField(default=1, verbose_name='severity', choices=[(0, 'information'), (1, 'critical error'), (2, 'value not saved'), (3, 'value partly saved')])),\n                ('text', akvo.rsr.fields.ValidXMLTextField(verbose_name='text')),\n                ('iati_import', models.ForeignKey(related_name='iati_import_logs', verbose_name='iati_import', to='rsr.IatiImport')),\n                ('project', models.ForeignKey(related_name='iati_project_import_logs', verbose_name='project', blank=True, to='rsr.Project', null=True)),\n            ],\n            options={\n                'verbose_name': 'IATI import log',\n                'verbose_name_plural': 'IATI import logs',\n            },\n            bases=(models.Model,),\n        ),\n        migrations.CreateModel(\n            name='IatiProjectImport',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('action', models.PositiveSmallIntegerField(verbose_name='action', choices=[(1, 'create'), (2, 'update')])),\n                ('status', models.PositiveSmallIntegerField(default=1, verbose_name='status', choices=[(1, 'pending'), (2, 'import in progress'), (3, 'completed'), (4, 'cancelled')])),\n                ('start_date', models.DateTimeField(null=True, verbose_name='start date', blank=True)),\n                ('end_date', models.DateTimeField(null=True, verbose_name='end date', blank=True)),\n                ('iati_import', models.ForeignKey(related_name='iati_project_imports', verbose_name='iati_import', to='rsr.IatiImport')),\n                ('project', models.ForeignKey(related_name='iati_project_imports', verbose_name='project', to='rsr.Project')),\n            ],\n            options={\n                'verbose_name': 'IATI project import',\n                'verbose_name_plural': 'IATI project imports',\n            },\n            bases=(models.Model,),\n        ),\n        migrations.AddField(\n            model_name='iatiimport',\n            name='projects',\n            field=models.ManyToManyField(to='rsr.Project', verbose_name='projects', through='rsr.IatiProjectImport', blank=True),\n            preserve_default=True,\n        ),\n        migrations.AddField(\n            model_name='iatiimport',\n            name='user',\n            field=models.ForeignKey(related_name='iati_imports', verbose_name='user', to=settings.AUTH_USER_MODEL),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='budgetitem',\n            name='amount',\n            field=models.DecimalField(null=True, verbose_name='amount', max_digits=14, decimal_places=2, blank=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='partnership',\n            name='funding_amount',\n            field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text=\"The funding amount of the partner.<br>Note that it's only possible to indicate a funding amount for funding partners.\", null=True, verbose_name='funding amount', db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='planneddisbursement',\n            name='value',\n            field=models.DecimalField(null=True, verbose_name='value', max_digits=14, decimal_places=2, blank=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='project',\n            name='budget',\n            field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, verbose_name='project budget', db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='project',\n            name='funds',\n            field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='project',\n            name='funds_needed',\n            field=models.DecimalField(decimal_places=2, default=0, max_digits=14, blank=True, null=True, db_index=True),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='transaction',\n            name='value',\n            field=models.DecimalField(decimal_places=2, max_digits=14, blank=True, help_text='Enter the transaction amount.', null=True, verbose_name='value'),\n            preserve_default=True,\n        ),\n        migrations.AlterField(\n            model_name='project',\n            name='iati_activity_id',\n            field=akvo.rsr.fields.ValidXMLCharField(null=True, max_length=100, blank=True, help_text='This should be the official unique IATI Identifier for the project. The identifier consists of the IATI organisation identifier and the (organisations internal) project identifier, e.g. NL-KVK-31156201-TZ1234. (100 characters)<br>Note that \\'projects\\' in this form are the same as \\'activities\\' in IATI.<br><a href=\"http://iatistandard.org/activity-standard/iati-activities/iati-activity/iati-identifier\" target=\"_blank\">How to create</a>', verbose_name='IATI Project Identifier', db_index=True),\n            preserve_default=True,\n        ),\n    ]\n", "path": "akvo/rsr/migrations/0032_auto_20151001_0956.py"}]}