Migrate default edition field to work model

Fixes #281
This commit is contained in:
Mouse Reeve
2020-11-04 10:35:13 -08:00
parent be4f41335e
commit ff96835c2a
5 changed files with 43 additions and 15 deletions

View File

@ -128,9 +128,10 @@ class AbstractConnector(ABC):
if not edition:
ed_key = self.get_remote_id_from_data(edition_data)
edition = self.create_book(ed_key, edition_data, models.Edition)
edition.default = True
edition.parent_work = work
edition.save()
work.default_edition = edition
work.save()
# now's our change to fill in author gaps
if not edition.authors and work.authors: