engineer.models¶
-
class
engineer.models.
Post
(source)[source]¶ Represents a post written in Markdown and stored in a file.
Parameters: source – path to the source file for the post. -
render_item
(all_posts)[source]¶ Renders the Post as HTML using the template specified in
html_template_path
.Parameters: all_posts – An optional PostCollection
containing all of the posts in the site.Returns: The rendered HTML as a string.
-
set_finalized_content
(content, caller_class)[source]¶ Plugins can call this method to modify post content that is written back to source post files. This method can be called at any time by anyone, but it has no effect if the caller is not granted the
MODIFY_RAW_POST
permission in the Engineer configuration.The
FINALIZE_METADATA
setting must also be enabled in order for calls to this method to have any effect.Parameters: - content – The modified post content that should be written back to the post source file.
- caller_class – The class of the plugin that’s calling this method.
Returns: True
if the content was successfully modified; otherwiseFalse
.
-
content
¶ The post’s content in HTML format.
-
content_template
= None¶ The path to the template to use to transform the post content into HTML.
-
custom_properties
= None¶ A dict of any custom metadata properties specified in the post.
-
is_draft
¶ True
if the post is a draft,False
otherwise.
-
is_external_link
¶ True
if the post has an associated external link.False
otherwise.
-
is_pending
¶ True
if the post is marked as published but has a timestamp set in the future.
-
is_published
¶ True
if the post is published,False
otherwise.
-
link
= None¶ The post’s external link.
-
markdown_template_path
= None¶ The path to the template to use to transform the post back into a post source file.
-
slug
= None¶ The slug for the post.
-
source
= None¶ The absolute path to the source file for the post.
-
status
= None¶ The status of the post (published or draft).
-
template
= None¶ The path to the template to use to transform the post into HTML.
-
timestamp
= None¶ The date/time the post was published or written.
-
timestamp_local
¶ The post’s
timestamp
in ‘local’ time.Local time is determined by the
POST_TIMEZONE
setting.
-
title
= None¶ The title of the post.
-
updated
= None¶ The date/time the post was updated.
-
via
= None¶ The post’s attribution name.
-
via_link
= None¶ The post’s attribution link.
-
-
class
engineer.models.
PostCollection
(seq=())[source]¶ A collection of
Posts
.-
tagged
(tag)[source]¶ Returns a new PostCollection containing the subset of posts that are tagged with tag.
Returns a list of all the unique tags, as strings, that posts in the collection have.
-
drafts
¶ Returns a new PostCollection containing the subset of posts that are drafts.
-
pending
¶ Returns a new PostCollection containing the subset of posts that are pending.
-
published
¶ Returns a new PostCollection containing the subset of posts that are published.
-
review
¶ Returns a new PostCollection containing the subset of posts whose status is
review
.
-