Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b94c4c54
authored
Oct 13, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: parse/format dates in HumanReadableObjects
closes #229
parent
2eac5bff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
circle/common/models.py
+9
-0
No files found.
circle/common/models.py
View file @
b94c4c54
...
...
@@ -32,6 +32,7 @@ from django.core.serializers.json import DjangoJSONEncoder
from
django.db.models
import
(
CharField
,
DateTimeField
,
ForeignKey
,
NullBooleanField
)
from
django.template
import
defaultfilters
from
django.utils
import
timezone
from
django.utils.encoding
import
force_text
from
django.utils.functional
import
Promise
...
...
@@ -428,6 +429,14 @@ class HumanReadableObject(object):
admin_text_template
=
admin_text_template
.
_proxy____args
[
0
]
self
.
user_text_template
=
user_text_template
self
.
admin_text_template
=
admin_text_template
for
k
,
v
in
params
.
iteritems
():
try
:
v
=
timezone
.
datetime
.
strptime
(
v
,
"
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S.
%
fZ"
)
.
replace
(
tzinfo
=
timezone
.
UTC
())
except
ValueError
:
pass
if
isinstance
(
v
,
timezone
.
datetime
):
params
[
k
]
=
defaultfilters
.
date
(
v
,
"DATETIME_FORMAT"
)
self
.
params
=
params
@classmethod
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment