Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page object not initializing on Home Page template #84

Open
LordXyTh opened this issue Nov 12, 2022 · 1 comment
Open

Page object not initializing on Home Page template #84

LordXyTh opened this issue Nov 12, 2022 · 1 comment
Labels
question Further information is requested

Comments

@LordXyTh
Copy link

Hello,

I've built the project, added a new field to the HomePage model, and added data via the admin panel.
However, when I'm trying to render {{page.body}} to the template, I get nothing. When I create a child page of the home page, it seems to work. But I need to be able to use all this for my home page. Not sure whats going on :(

models.py
`from wagtail.models import Page
from wagtail.fields import RichTextField
from wagtail.admin.panels import FieldPanel

class HomePage(Page):
body = RichTextField(blank=True)

content_panels = Page.content_panels + [
    FieldPanel('body'),
]`

templates/home/home_page.html

`{% extends "base.html" %}

{% load wagtailcore_tags %}

{% block body_class %}template-homepage{% endblock %}

{% block content %}

{{page.title}}
{{ page.body|richtext }}

{% endblock %}`

@LordXyTh LordXyTh added the question Further information is requested label Nov 12, 2022
@exotriks
Copy link

I think it's because wagtail use a template system based on classes
see here https://www.youtube.com/watch?v=plggtgoQjcs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants