Re: [mezzanine-users] existence of template overrides page content

109 views
Skip to first unread message

Josh Cartmell

unread,
Jun 3, 2013, 4:20:30 PM6/3/13
to mezzani...@googlegroups.com
When you create a template that has the same name as a Page's slug it used to render that page.  The only way the Page's content will show up is if you set it up to show in the template or one of it's ancestor templates.  Two options would be:

1.  Copy the contents of the corresponding content types template (pages/richtextpage.html for example) to your blah.html template and then modify it to add in the extra content that is not driven by the backend.
2.  Set up blah.html to extend richtextpage.html and then do something like this:

{% block main %}
{{ block.super }}
...You extra content here...
{% endblock %}

Hopefully that helps you figure out what you want to do.  Let us know how it goes!

Regards,
Josh


On Mon, Jun 3, 2013 at 12:55 PM, sweetbits <sweet...@gmail.com> wrote:

brand new to Mezzanine, but noticed quickly that if i create
a page "blah" w/ some content via the Admin gui, and then
create a template: templates/pages/blah.html, the content
doesn't show.

So the existence of the template overrides
the gui-created page content.

I guess i hoped that the gui
content would get dumped into the rendered "block main" area of the
template, and that i could put non-gui-created content/logic elsewhere
in the template.

Sort of makes sense, but am wondering if it is
possible to have hybrid content like this, and if not,
what is the correct approach, if you'd like your gui-created pages
to use slightly different templates.

thx, chris.


--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

sweetbits

unread,
Jun 3, 2013, 5:00:03 PM6/3/13
to mezzani...@googlegroups.com
thx Josh, really helpful (and quick) response,

the key to pull content from the page:
{{ page.richtextpage.content|richtext_filter|safe }}
Message has been deleted

Steve Jain

unread,
Jun 15, 2013, 10:37:38 PM6/15/13
to mezzani...@googlegroups.com
Sorry to revive an old thread, but this material is very close to a n00b question I have: where/how does content entered in the WYSIWYG editor in the admin get stored?

Let's say I start out with a brand new Mezzanine installation and create a new Page called 'FAQ' with 'Hello world' in the body.

I haven't added any custom templates in my project template directory yet.

When I go to the FAQ page in the browser, 'Hello world' shows up in the body. Where's it coming from?

I know 'Hello world' is being appended to the main block in pages/page.html, but I cannot figure where it's coming from. Can anyone point me in the right direction? Thanks...

steve

sweetbits

unread,
Jun 15, 2013, 11:34:11 PM6/15/13
to Mezzanine Users
from the database (the DB table: pages_richtextpage i would expect )

Steve Jain

unread,
Jun 15, 2013, 11:52:49 PM6/15/13
to mezzani...@googlegroups.com
Thanks.

Josh Cartmell

unread,
Jun 17, 2013, 12:05:05 AM6/17/13
to mezzani...@googlegroups.com
Hey Steve the database tables are set up by the Django models, in this case mezzanine.pages.models.RichTextPage.  Since Mezzanine is just Django I would recommend going through the Django tutorial, https://docs.djangoproject.com/en/dev/intro/tutorial01/, to get a good feel for basic Django concepts and how a lot of things (like the database) work.

Good luck!

Josh


On Sat, Jun 15, 2013 at 8:52 PM, Steve Jain <steve...@gmail.com> wrote:
Thanks.
Reply all
Reply to author
Forward
0 new messages