Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy affiliation data to incident targets
We are phasing out the one-affiliation-per-incident affiliation model in favor of an Institution model, which can either be applied on a journalist by journalist basis, or to the incident as a whole, but as many as desired. For this, we must move data from the legacy affiliation field to the new Institution field. We do this using a data migration, with two pre- and post- migrations to work around this bug in djang-modelcluster: wagtail/django-modelcluster#96 For the migration, we want these steps: 1. For each incident, examine the `affiliation` field 2. If it null or set to the default value of "Independent," discard it. The "independent" value is a placeholder for no definite affiliation and will not be used in the new scheme. 3. Create, if it doesn't already exist, an Institution with the title of the affiliation. 4. If this incident has any targeted journalists who do not already have an associated institution, associate the new institution with them. 5. If this incident does *not* have any targeted journalists, add the new institution as a target of this incident. This will fully bring any affiliation data into the institution model and apply it to the incidents that this data described.
- Loading branch information