APSL/puput

`puput_initial_data` fails on clean installation

michalpleszczynski opened this issue · 2 comments

Hi,

Looks like following the "Standalone blog app" instructions will result in puput.models.DoesNotExist: BlogPage matching query does not exist. exception, when running python manage.py puput_initial_data step.

From what I can see the problem is caused by the fact that at the beginning of puput_initial_data we're getting content type for BlogPage class, but then creating a Page object. So at this point we have 3 Page objects and 0 BlogPage objects, so when doing revision.publish() at the end puput_initial_data we finally arrive at the line:

return content_type.get_object_for_this_type(id=self.id)

in wagtail.core.models.Page.specific() where content_type is BlogPage, but self.id points to an id of a Page object.

I changed:

        # Create example blog page
        blogpage = Page(
            title="Blog",
            content_type=blogpage_content_type,
            slug='blog',
        )

to

        # Create example blog page
        blogpage = BlogPage(
            title="Blog",
            content_type=blogpage_content_type,
            slug='blog',
        )

and everything worked fine. I'm happy to create a PR, if all that chaotic stuff I wrote above makes sense :)

Versions:

beautifulsoup4==4.6.0
certifi==2019.11.28
chardet==3.0.4
Django==2.2.8
django-colorful==1.3
django-el-pagination==3.2.4
django-modelcluster==5.0
django-social-share==1.3.2
django-taggit==1.2.0
django-treebeard==4.3
djangorestframework==3.10.3
draftjs-exporter==2.1.7
html5lib==1.0.1
idna==2.8
Pillow==6.2.1
psycopg2==2.8.4
puput==1.0.6
pytz==2019.3
requests==2.22.0
six==1.13.0
sqlparse==0.3.0
Unidecode==1.1.1
urllib3==1.25.7
wagtail==2.7
webencodings==0.5.1
Willow==1.3

I'm happy to create a PR, if all that chaotic stuff I wrote above makes sense :)

Please! 😄