I have two models in a wagtail app, PageType
and NewPageType
, and need to replace PageType
with NewPageType
.
I thought I could remove PageType
from my models.py
and then run a migration to remove it, and then rename NewPageType
to PageType
and run a second migration.
However, I'm running into errors when I do this:
[2019-01-22 23:20:26,344] [ERROR] Internal Server Error: /cms/
Traceback (most recent call last):
File "/.../python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/.../python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
[...snip...]
File "/.../python3.6/site-packages/django/db/models/query.py", line 1121, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/.../python3.6/site-packages/wagtail/core/query.py", line 397, in specific_iterator
yield pages_by_type[content_type][pk]
KeyError: 278
It seems like something didn't get updated automatically by Django's built-in migration handling. I couldn't tell what steps I'm missing here so would love to get some help. Thanks!