Deleted Model...but page still shows in Admin?

1,058 views
Skip to first unread message

Ryan Nevius

unread,
May 27, 2015, 9:00:00 AM5/27/15
to wag...@googlegroups.com, Ryan Nevius
I had a custom page model called "OurStoryPage". I deleted this page model and ran migrations, but it's still showing in the admin.

I can navigate to the page edit screen in the Admin...but I can't delete it or update it. Instead, I get the following error:

Request URL:http://127.0.0.1:8080/admin/pages/24/delete/
Django Version:1.7.7
Exception Type:DoesNotExist
Exception Value:
OurStoryPage matching query does not exist.
Exception Location:/vagrant/.venv/lib/python3.4/site-packages/django/db/models/query.py in get, line 357

I thought this was odd, so I headed to the shell to try to delete in manually. In the shell, I tried to delete the page by using `Page.objects.filter(id=24)[0].delete()`.

The page is successfully queried and found, but running `delete()` returns `pages.models.DoesNotExist: OurStoryPage matching query does not exist.`

Any ideas what's going on? I'm assuming it's some kind of relationship that still exists in the database...but I'm wondering if I'm just missing something simple.

Ryan Nevius

unread,
May 27, 2015, 9:01:47 AM5/27/15
to wag...@googlegroups.com
I guess I should clarify...By "it's still showing in the Admin', I mean that a page instance (of the OurStoryPage type) is showing.
Message has been deleted
Message has been deleted

pjgb

unread,
May 27, 2015, 12:44:46 PM5/27/15
to wag...@googlegroups.com
If the page still exists in the db it should be listed in the table wagtailcore_page provided it's part of the Page class.
If it the page with id 24 isn't in wagtailcore_page, wild thought: cache issue?

Brett Grace

unread,
May 30, 2015, 2:09:10 PM5/30/15
to wag...@googlegroups.com
If I understand correctly, you dropped the table for the OurStoryPage model while you had instances of it in the page hierarchy? I can imagine that this put things into an inconsistent state. I wonder if the "fixtree" management command can garbage collect that node (I'm not sure how conservative it is with your data so take a snapshot of the database first).

Ryan Nevius

unread,
Jun 1, 2015, 2:40:03 AM6/1/15
to wag...@googlegroups.com
You're correct. The fixtree command didn't do it for me. In the end, I restored an earlier snapshot of the database. 

Thanks for the help!

--
You received this message because you are subscribed to a topic in the Google Groups "Wagtail support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wagtail/qEev231T0TQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wagtail+u...@googlegroups.com.
To post to this group, send email to wag...@googlegroups.com.
Visit this group at http://groups.google.com/group/wagtail.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wagtail/edea7020-d167-4996-b5a5-48ba129c88b3%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages