Let's start with the get() call
from mezzanine.pages.models import Page
mypage = Page.objects.get(title="My title")
Since the "content" field is part of the RichTextPage subclass, we need
to access it through the relation: mypage.richtextpage.content.
If the page were a Form, it would be: mypage.form.content.
If you don't know what kind of Page subclass you're dealing with, you
can call get_content_model() to figure it out: mypage.get_content_model()
That would return RichTextPage, or Form, or your own custom page types.
You can chain field access as well: mypage.get_content_model().some_field
On 2017-09-24 2:23 PM, Malik Rumi wrote:
On Sunday, September 24, 2017 at 1:19:51 PM UTC-7, Malik Rumi wrote:
I have seen this post:
https://groups.google.com/forum/#!searchin/mezzanine-users/shell%7Csort:relevance/mezzanine-users/BhEelJ3gvf4/4g4QZwwXNPQJ
<https://groups.google.com/forum/#%21searchin/mezzanine-users/shell%7Csort:relevance/mezzanine-users/BhEelJ3gvf4/4g4QZwwXNPQJ>
It does not answer the question, how to access page content
programmatically?
update:
i.e., the Page equivalent of
>>> testpage2 = BlogPost.objects.get(title__contains="091517 status")
>>> testpage2.content
....text displays....
--
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 [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.