diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-10-24 16:05:18 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-10-24 16:05:18 +0700 |
| commit | 1934b5ca55840deb2a4369ef6ab0affd86e2ba8f (patch) | |
| tree | 7ac4d5f054ddff5b8293b6045de9061d73dab8ab /indoteknik_api/models | |
| parent | a069927b8f9b2b5942dffc241ed8b79f2d57ecf8 (diff) | |
(create_date -> post_date) in blog rest api
add "tags" in blog rest api
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/blog_post.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/indoteknik_api/models/blog_post.py b/indoteknik_api/models/blog_post.py index 3f3444c3..2a82c23c 100644 --- a/indoteknik_api/models/blog_post.py +++ b/indoteknik_api/models/blog_post.py @@ -13,7 +13,7 @@ class BlogPost(models.Model): 'title': blog.name, 'category': {}, 'author': {}, - 'create_date': blog.create_date.astimezone(timezone('Asia/Jakarta')).strftime('%d/%m/%Y') or '', + 'post_date': blog.post_date.astimezone(timezone('Asia/Jakarta')).strftime('%d/%m/%Y') or '', } if blog.blog_id: data['category'] = { @@ -32,7 +32,13 @@ class BlogPost(models.Model): 'description': blog.website_meta_description, 'keywords': blog.website_meta_keywords }, + 'tags': [], 'content': blog.content, } + for tag in blog.tag_ids: + data_with_detail['tags'].append({ + 'id': tag.id, + 'name': tag.name, + }) data.update(data_with_detail) return data
\ No newline at end of file |
