Changing Models

See online documentation at https://docs.djangoproject.com/en/3.0/topics/migrations/

The steps below can be seen in commit https://github.molgen.mpg.de/EditionOpenAccess/django-eoapublications/commit/9c362de9f2cd104e278d0fbdca59fed75dd331e6

models.py

The paragraph style ‘divider’ is to be added. In models.py, add it to the KINDS array:

  KINDS = (
    ('eoaparagraph', 'Paragraph'),
    # ...
    ('eoadivider', 'Divider')
)

Make the migration, specifying a message and the app:

$ python manage.py makemigrations --name add_divider eoapublications
#  Migrations for 'eoapublications':
#     eoapublications/migrations/0003_add_divider.py
#       - Alter field Kind on element

Then, migrate:

python manage.py migrate

Now, the new paragraph type is available:

New paragraph kind added to model

publicationimport

The publicationimport script has to be made aware of a new field and how it should deal with it (see https://github.molgen.mpg.de/EditionOpenAccess/django-eoapublications/commit/9c362de9f2cd104e278d0fbdca59fed75dd331e6#diff-f56c1a061762893512c03db32248d05f).

templates

Additionally, the templates need to know how to render the new field (see https://github.molgen.mpg.de/EditionOpenAccess/django-eoapublications/commit/9c362de9f2cd104e278d0fbdca59fed75dd331e6#diff-73961337cb59c4fc10c6600d78ce2f38 and https://github.molgen.mpg.de/EditionOpenAccess/django-eoapublications/commit/9c362de9f2cd104e278d0fbdca59fed75dd331e6#diff-9da26c07709b591cbc6db9940b44cfe2).

Distributing models

In order to apply these changes to other running instances, commit the migration together with the other changes. See Update components on how to update and migrate changes.