Browse Source

one datetime format

Guénaël Muller 6 years ago
parent
commit
e1a4cbe30b
2 changed files with 7 additions and 5 deletions
  1. 1 0
      tracim/lib/utils/utils.py
  2. 6 5
      tracim/views/core_api/schemas.py

+ 1 - 0
tracim/lib/utils/utils.py View File

@@ -5,6 +5,7 @@ from rq import Queue
5 5
 
6 6
 from tracim.config import CFG
7 7
 
8
+DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
8 9
 DEFAULT_WEBDAV_CONFIG_FILE = "wsgidav.conf"
9 10
 DEFAULT_TRACIM_CONFIG_FILE = "development.ini"
10 11
 

+ 6 - 5
tracim/views/core_api/schemas.py View File

@@ -3,6 +3,7 @@ import marshmallow
3 3
 from marshmallow import post_load
4 4
 from marshmallow.validate import OneOf
5 5
 
6
+from tracim.lib.utils.utils import DATETIME_FORMAT
6 7
 from tracim.models.auth import Profile
7 8
 from tracim.models.contents import CONTENT_DEFAULT_TYPE
8 9
 from tracim.models.contents import CONTENT_DEFAULT_STATUS
@@ -47,7 +48,7 @@ class UserSchema(UserDigestSchema):
47 48
         example='suri.cate@algoo.fr'
48 49
     )
49 50
     created = marshmallow.fields.DateTime(
50
-        format='%Y-%m-%dT%H:%M:%SZ',
51
+        format=DATETIME_FORMAT,
51 52
         description='User account creation date',
52 53
     )
53 54
     is_active = marshmallow.fields.Bool(
@@ -391,12 +392,12 @@ class ContentDigestSchema(marshmallow.Schema):
391 392
 class ContentSchema(ContentDigestSchema):
392 393
     current_revision_id = marshmallow.fields.Int(example=12)
393 394
     created = marshmallow.fields.DateTime(
394
-        format='%Y-%m-%dT%H:%M:%SZ',
395
+        format=DATETIME_FORMAT,
395 396
         description='Content creation date',
396 397
     )
397 398
     author = marshmallow.fields.Nested(UserDigestSchema)
398 399
     modified = marshmallow.fields.DateTime(
399
-        format='%Y-%m-%dT%H:%M:%SZ',
400
+        format=DATETIME_FORMAT,
400 401
         description='date of last modification of content',
401 402
     )
402 403
     last_modifier = marshmallow.fields.Nested(UserDigestSchema)
@@ -426,7 +427,7 @@ class RevisionSchema(ContentDigestSchema):
426 427
     comment_ids = marshmallow.fields.List(marshmallow.fields.Int(example=4))
427 428
     revision_id = marshmallow.fields.Int(example=12)
428 429
     created = marshmallow.fields.DateTime(
429
-        format='%Y-%m-%dT%H:%M:%SZ',
430
+        format=DATETIME_FORMAT,
430 431
         description='Content creation date',
431 432
     )
432 433
     author = marshmallow.fields.Nested(UserDigestSchema)
@@ -458,7 +459,7 @@ class CommentSchema(marshmallow.Schema):
458 459
     )
459 460
     author = marshmallow.fields.Nested(UserDigestSchema)
460 461
     created = marshmallow.fields.DateTime(
461
-        format='%Y-%m-%dT%H:%M:%SZ',
462
+        format=DATETIME_FORMAT,
462 463
         description='comment creation date',
463 464
     )
464 465