Can specify date format in dyn:date
This commit is contained in:
parent
179fc3da2f
commit
5b3eafe758
|
@ -22,6 +22,7 @@ class Index(DynastieGenerator):
|
|||
|
||||
self.hooks = {'posts' : self.createPosts,
|
||||
'title' : self.createTitle,
|
||||
'date' : self.createDate,
|
||||
'navigation' : self.createNavigation,
|
||||
'recents' : self.createRecents,
|
||||
'tags' : self.createTags,
|
||||
|
@ -106,6 +107,16 @@ class Index(DynastieGenerator):
|
|||
|
||||
root.replaceChild(node, title_elem)
|
||||
|
||||
def createDate(self, posts, dom, root, date_elem):
|
||||
date_format = date_elem.getAttribute('format')
|
||||
if date_format == '':
|
||||
date_format = '%A, %d %B %Y %H:%m'
|
||||
|
||||
post = self.cur_post_obj
|
||||
node = self.createElement(dom, 'date', post.creation_date.strftime(date_format))
|
||||
|
||||
root.replaceChild(node, date_elem)
|
||||
|
||||
def createPost(self, posts, dom, post_elem, root):
|
||||
post = self.cur_post_obj
|
||||
|
||||
|
@ -115,7 +126,6 @@ class Index(DynastieGenerator):
|
|||
|
||||
values = {}
|
||||
values['author'] = post.author.first_name + ' ' + post.author.last_name
|
||||
values['date'] = post.creation_date.strftime('%A, %d %B %Y %H:%m')
|
||||
values['post_content'] = ''
|
||||
|
||||
blog = post.blog
|
||||
|
|
Loading…
Reference in New Issue
Block a user