mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Set timezone when assigning max datetime to drafts
This commit is contained in:
parent
bf85991ee6
commit
cff6a829c2
2 changed files with 3 additions and 2 deletions
|
|
@ -121,6 +121,7 @@ class Content(object):
|
||||||
# manage timezone
|
# manage timezone
|
||||||
default_timezone = settings.get('TIMEZONE', 'UTC')
|
default_timezone = settings.get('TIMEZONE', 'UTC')
|
||||||
timezone = getattr(self, 'timezone', default_timezone)
|
timezone = getattr(self, 'timezone', default_timezone)
|
||||||
|
self.timezone = pytz.timezone(timezone)
|
||||||
|
|
||||||
if hasattr(self, 'date'):
|
if hasattr(self, 'date'):
|
||||||
self.date = set_date_tzinfo(self.date, timezone)
|
self.date = set_date_tzinfo(self.date, timezone)
|
||||||
|
|
@ -512,7 +513,7 @@ class Article(Content):
|
||||||
|
|
||||||
# if we are a draft and there is no date provided, set max datetime
|
# if we are a draft and there is no date provided, set max datetime
|
||||||
if not hasattr(self, 'date') and self.status == 'draft':
|
if not hasattr(self, 'date') and self.status == 'draft':
|
||||||
self.date = datetime.datetime.max
|
self.date = datetime.datetime.max.replace(tzinfo=self.timezone)
|
||||||
|
|
||||||
def _expand_settings(self, key):
|
def _expand_settings(self, key):
|
||||||
klass = 'draft' if self.status == 'draft' else 'article'
|
klass = 'draft' if self.status == 'draft' else 'article'
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<div class="entry-content">
|
<div class="entry-content">
|
||||||
<footer class="post-info">
|
<footer class="post-info">
|
||||||
<abbr class="published" title="9999-12-31T23:59:59.999999">
|
<abbr class="published" title="9999-12-31T23:59:59.999999+00:00">
|
||||||
Published:
|
Published:
|
||||||
</abbr>
|
</abbr>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue