wagtail.org icon indicating copy to clipboard operation
wagtail.org copied to clipboard

Value Error at Pattern Library - fullpageurl tag expected a Page object

Open MugoBrian opened this issue 2 years ago • 1 comments

Issue: The following error (see screenshot below) is being encountered when accessing the following pages: home_page.html content_page.html blog_page.html

Steps To Reproduce The Error: Start the wagtail.org server To access the:

  1. home_page.html head to pattern-library/pattern/patterns/pages/home/home_page.html
  2. content_page.html head to pattern-library/pattern/patterns/pages/content_page/content_page.html
  3. blog_page.html head to pattern-library/pattern/patterns/pages/blog/blog_page.html

Environment Used: The issue occurs in both of these environments both using Docker and Chrome Browser Version 118.0.5993.117 (Official Build) (64-bit):

  1. Gitpod
  2. Locally (Ubuntu 22.0.4)

Screenshot from 2023-10-28 09-30-04

MugoBrian avatar Oct 28 '23 06:10 MugoBrian

@thibaudcolas First two are not reproducible anymore, probably resolved by past commits

Screenshots

Image Image

but 3rd one is still reproducible:

Screenshots

Firefox:

Image

Chrome:

Image

I tried to debug it and and found that checking for {% if page.main_image %} evolutes true and main_image's value is also True

main_image is `True`

Image

why does it give True as above ?, I wonder that it should be either null or blank as per model !!?:

https://github.com/wagtail/wagtail.org/blob/5eac6fb3c1bf79be093e55bcac0cb8b2217e5f41/wagtailio/blog/models.py#L141-L147

Currently, we can check for the file field for main_image instead of just main_image, {% if page.main_image.file %} and it works fine (should i raise PR with this approach?).

https://github.com/wagtail/wagtail.org/blob/5eac6fb3c1bf79be093e55bcac0cb8b2217e5f41/wagtailio/images/models.py#L8-L11

No more ValueError

replaced all {% if page.main_image %} to {% if page.main_image.file %} (total 3)

Image

ayaan-qadri avatar Dec 16 '24 21:12 ayaan-qadri