From ca18c1e40971df1cf796ec5862688d8e1873e76e Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Fri, 18 Nov 2022 14:02:44 +0700 Subject: Manufacture detail rest api --- indoteknik_api/models/x_manufactures.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indoteknik_api/models') diff --git a/indoteknik_api/models/x_manufactures.py b/indoteknik_api/models/x_manufactures.py index 6755ac66..29f99063 100644 --- a/indoteknik_api/models/x_manufactures.py +++ b/indoteknik_api/models/x_manufactures.py @@ -9,6 +9,15 @@ class Manufactures(models.Model): data = { 'id': manufacture.id, 'logo': base_url + 'api/image/x_manufactures/x_logo_manufacture/' + str(manufacture.id) if manufacture.x_logo_manufacture else '', - 'name': manufacture.x_name, + 'name': manufacture.x_name } + if with_detail: + data_with_detail = { + 'banners': [ + base_url + 'api/image/x_banner.banner/x_banner_image/' + str(x.id) + for x in manufacture.x_manufactures_banners + if x.x_status_banner == 'tayang' and x.x_banner_image + ] + } + data.update(data_with_detail) return data \ No newline at end of file -- cgit v1.2.3