diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-11-21 16:08:11 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-11-21 16:08:11 +0700 |
| commit | 75694b2b47729a71f1ec50639063f0e924aa90b2 (patch) | |
| tree | 1c7bc1597d8786f85a96fb6c25d1a2f1ae4b3cb2 /indoteknik_api/controllers/api_v1 | |
| parent | 5c3110cb0bda84436dcb3eed94a76a45571626fc (diff) | |
manufacture filter by name
Diffstat (limited to 'indoteknik_api/controllers/api_v1')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/manufacture.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/api_v1/manufacture.py b/indoteknik_api/controllers/api_v1/manufacture.py index 544113f2..b01dc49d 100644 --- a/indoteknik_api/controllers/api_v1/manufacture.py +++ b/indoteknik_api/controllers/api_v1/manufacture.py @@ -14,10 +14,15 @@ class Manufacture(controller.Controller): query = [] + name = kw.get('name') + level = kw.get('level') limit = int(kw.get('limit', 0)) offset = int(kw.get('offset', 0)) - level = kw.get('level') + if name: + name = '%' + name.replace(' ', '%') + '%' if '%' not in name else name + query.append(('x_name', '=ilike', name)) + if level: if level not in ['prioritas', 'gold', 'silver']: return self.response(code=400, description='level possible value is prioritas, gold, silver') |
