models.Post
- Post¶crotal.models.
Post
(**attributes)[source]¶Model Post
for posts in the blog.
Attributes:
PATH
: A list of relative paths where this model is related to, please
use the relative path to this script.
FILE_EXTENSIONS
: A list containing file extensions. Only the files
with these file extensions shall be read by the model.
title
: Title of the post.
slug
: Slug of the post that may be used in its url.
pub_date
: Publication date of the post.
tags
: A list of Tags that the post is related to.
categories
: A list of Categories that the post belongs to.
raw_content
: The raw markdown content of the post.
html_content
: The html format post content generated from markdown
file(raw_content).
short_html_content
: A short version of the html_content
, which
may be represented on the index page.
create
()[source]¶This method:
load_extra_items
(config)[source]¶Load Archive
, Categorie
and Tag
objects created from this Post
into the object manger of their own class.
:param config:
:return:
generate_url
(permalink)[source]¶Save the post url by the permalink in config file.
The permalink is seperated into servel parts from '/'. If one part of it startswith ':', then we should find whether there is attribute with the same name in the post. If not, we take it as a string.
example:
'/post/2013/11/hello-world/' can be generated from /post/:year/:month/:title