You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a page preview block using the form inputs template on the home page that is targeting home/subpage-1/subpage-2. subpage-2 is a Form Page with a text input and a dropdown input. This error is not triggering on coderedcms v.0.16.3. Is there additional context I am missing to replicate the error?
So subpage contains a preview of itself? If that is the case then it would definitely break. If subpage contains a preview of subpage* then it should work in theory, although it would likely break if subpage* is unpublished.
Can you confirm that the site name and port under Settings > Site is correctly set? i.e. it should match your domain (www.example.com) and port (80 for http, 443 for https).
-Article Index Page
--Article with Form Inputs preview (Sign up for our newsletter)
The Article shows the inputs and accepts the form properly, I'm thinking it may have something to do with the index page grabbing the body content of the Article for the text preview.
Interesting, this must be related to trying to fetch child pages of the page while it is in "preview" state (it is technically not a page object during preview, it is some kind of special ephemeral preview object). This has long been a cryptic issue, thanks for investigating!
A fix might be to add a try/except to body_preview() method, or to add special logic during render() of previews.
Run into a similar error message when running a search:
Start condition: there's a page ("Contact") with page preview block, pointing at a form ("Contact Form") ("Contact" and "Contact Form" are both children of "Home"), everything is published, no draft versions.
Case A) Running a search across the site, with a term that does not gives a match for "Home", Page Preview Template: "Form inputs" -> success, no error, other pages are found
Case B) Running a search across the site, search term should give a match for "Home", Page Preview Template: "Default" -> no error, other pages plus "Home" are found
Case C) Running a search across the site, search term should give a match for "Home", Page Preview Template: "Card" -> no error, other pages plus "Home" are found
Case D) Running a search across the site, search term should give a match for "Home", Page Preview Template: "Form inputs" -> 'str' object has no attribute 'method'
Exception Location: /home/user/.local/share/virtualenvs/app-0IWFc-Ol/lib/python3.9/site-packages/coderedcms/models/page_models.py, line 1504, in get_form
Error during template rendering
In template /home/user/.local/share/virtualenvs/app-0IWFc-Ol/lib/python3.9/site-packages/coderedcms/templates/coderedcms/blocks/pagepreview_form.html, error at line 6
'str' object has no attribute 'method'
1 {% extends "coderedcms/blocks/base_block.html" %}
2 {% load django_bootstrap5 coderedcms_tags wagtailcore_tags %}
3 {% block block_render %}
4 {% with page=self.page.specific %}
5 {% if page.form_live %} 6 {% get_pageform page request as form %}
Activity
corysutyak commentedon Oct 2, 2019
I have a page preview block using the form inputs template on the home page that is targeting
home/subpage-1/subpage-2.subpage-2is a Form Page with a text input and a dropdown input. This error is not triggering on coderedcms v.0.16.3. Is there additional context I am missing to replicate the error?vsalvino commentedon Oct 2, 2019
Thanks for the steps to reproduce. Just so I understand clearly...
jquiroz90 commentedon Oct 2, 2019
Then home-page and subpage are broken.
vsalvino commentedon Oct 2, 2019
So
subpagecontains a preview of itself? If that is the case then it would definitely break. Ifsubpagecontains a preview ofsubpage*then it should work in theory, although it would likely break ifsubpage*is unpublished.jquiroz90 commentedon Oct 2, 2019
No, it doesn't contain a preview of itself, form page is another one. But, yes, it's unpublished.
vsalvino commentedon Oct 2, 2019
Try publishing the page. I believe that is the problem.
jquiroz90 commentedon Oct 2, 2019
I published it but the problem still persists
vsalvino commentedon Apr 11, 2020
Closing due to inactivity / needs more info to reproduce the problem.
pascalthivierge commentedon Dec 10, 2020
I get the same problem when using form page preview on an article page : 'str' object has no attribute 'method'.
Home page (Web Page)
|- subpage (Article Index Page)
|- sub-subpage (Article Page) - page preview of form page
|- subpage (Form Page)
pascalthivierge commentedon Dec 10, 2020
I'm using Wagtailtrans, but I doubt it would be the problem.
pascalthivierge commentedon Dec 10, 2020
I should add that the page preview of a form input on a standard web page works... but not on an article page under article page index.
vsalvino commentedon Dec 10, 2020
Can you confirm that the site name and port under Settings > Site is correctly set? i.e. it should match your domain (www.example.com) and port (80 for http, 443 for https).
pascalthivierge commentedon Dec 11, 2020
yes, the hostname match my domain name and using https with port 443
Boomacroom commentedon Dec 30, 2020
I'm having this issues as well.
-Article Index Page
--Article with Form Inputs preview (Sign up for our newsletter)
The Article shows the inputs and accepts the form properly, I'm thinking it may have something to do with the index page grabbing the body content of the Article for the text preview.
Boomacroom commentedon Dec 30, 2020
Using the template tag truncatewords, will give the same error.
Commenting out the following fixed the issue for me.
{% if self.show_preview_text %}<p>{{article.specific.body_preview}}</p>{% endif %}vsalvino commentedon Jan 5, 2021
Interesting, this must be related to trying to fetch child pages of the page while it is in "preview" state (it is technically not a page object during preview, it is some kind of special ephemeral preview object). This has long been a cryptic issue, thanks for investigating!
A fix might be to add a try/except to
body_preview()method, or to add special logic duringrender()of previews.pbspm01 commentedon Sep 30, 2022
Run into a similar error message when running a search:
Start condition: there's a page ("Contact") with page preview block, pointing at a form ("Contact Form") ("Contact" and "Contact Form" are both children of "Home"), everything is published, no draft versions.
Exception Location: /home/user/.local/share/virtualenvs/app-0IWFc-Ol/lib/python3.9/site-packages/coderedcms/models/page_models.py, line 1504, in get_form
Error during template rendering
In template /home/user/.local/share/virtualenvs/app-0IWFc-Ol/lib/python3.9/site-packages/coderedcms/templates/coderedcms/blocks/pagepreview_form.html, error at line 6
'str' object has no attribute 'method'
1 {% extends "coderedcms/blocks/base_block.html" %}
2 {% load django_bootstrap5 coderedcms_tags wagtailcore_tags %}
3 {% block block_render %}
4 {% with page=self.page.specific %}
5 {% if page.form_live %}
6 {% get_pageform page request as form %}
Django Version: 4.0.7
Python Version: 3.9.2
Coderedcms : 1.0.1
The "Contact Form" works otherwise for submission as intended from all Page Previews (with "Form inputs") and in itself as well.
Nonetheless, Coderedcms is some awesome work! Truly appreciated!