-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAR-731 - organisations improvement (#223): - add gov organisations to CSV export and dataset endpoint - add organisation filter to barrier list endpoint - add non ministerial departments
- Loading branch information
Showing
11 changed files
with
189 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
api/metadata/migrations/0019_add_non_ministerial_departments.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
from django.db import migrations | ||
|
||
from api.metadata.constants import OrganisationType | ||
|
||
|
||
ORGANISATIONS = [ | ||
{ | ||
"name": "The Charity Commission", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Competition and Markets Authority", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Crown Prosecution Service", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Food Standards Agency", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Forestry Commission", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Government Actuary's Department", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Government Legal Department", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "HM Land Registry", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "HM Revenue & Customs", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "NS&I", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "The National Archives", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "National Crime Agency", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Office of Rail and Road", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Ofgem", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Ofqual", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Ofsted", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Serious Fraud Office", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "Supreme Court of the United Kingdom", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "UK Statistics Authority", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
}, | ||
{ | ||
"name": "The Water Services Regulation Authority", | ||
"organisation_type": OrganisationType.NON_MINISTERIAL_DEPARTMENTS | ||
} | ||
] | ||
|
||
|
||
def create_organisations(apps, schema_editor): | ||
Organisation = apps.get_model("metadata", "Organisation") | ||
|
||
for item in ORGANISATIONS: | ||
Organisation.objects.create(**item) | ||
|
||
|
||
def delete_organisations(apps, schema_editor): | ||
Organisation = apps.get_model("metadata", "Organisation") | ||
|
||
for item in ORGANISATIONS: | ||
Organisation.objects.delete(**item) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("metadata", "0018_auto_20201118_1133"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(create_organisations, reverse_code=delete_organisations), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters