Fakultas Ilmu Komputer UI

Commit 6cb34cc2 authored by BIMO IMAN SMARTADI's avatar BIMO IMAN SMARTADI
Browse files

Merge branch 'coldfix' into 'staging'

Coldfix komentar time format

See merge request !52
parents 0ef61934 333a0d58
Pipeline #45068 passed with stages
in 14 minutes and 25 seconds
......@@ -35,8 +35,9 @@ class KomentarRelatedViewTest(InformasiFasilitasViewTest):
kwargs={'nama_lokasi': self.default_lokasi_name,
'id': 1,
comment_data = {"deskripsi": "halo saya komen"}
comment_data = {'deskripsi': "halo saya komen"}
response = client.post(urls, comment_data)
self.assertEqual(response.status_code, HTTPStatus.CREATED)
def test_not_comment_facility_empty(self):
......@@ -253,7 +253,9 @@ def add_komentar(request, nama_lokasi, id):
komentar = Komentar.objects.create(fasilitas=fasilitas,
return JsonResponse({'response': 'komentar added', 'id': komentar.id}, status=HTTPStatus.CREATED)
return JsonResponse({'response': 'komentar added',
'id': komentar.id,
"created_date": komentar.date_time.strftime("%d-%m-%Y %H:%M:%S")}, status=HTTPStatus.CREATED)
except KeyError as e:
return JsonResponse({'response': missing_key_message(str(e))}, status=HTTPStatus.BAD_REQUEST)
except Exception as e:
......@@ -276,9 +278,11 @@ def list_komentar(request, nama_lokasi, id):
komentar_details["id"] = komentar.id
komentar_details["deskripsi"] = komentar.deskripsi
komentar_details["creator"] = komentar.user.last_name
komentar_details["date_time"] = komentar.date_time
return JsonResponse(return_json, status=200)
except KeyError as e:
return JsonResponse({'response': missing_key_message(str(e))}, status=500)
except Exception as e:
return JsonResponse({'response': str(e)}, status=404)
komentar_details["date_time"] = komentar.date_time.strftime(
"%d-%m-%Y %H:%M:%S")
return JsonResponse(return_json, status=HTTPStatus.OK)
except KeyError as key:
return JsonResponse({'response': missing_key_message(str(key))},
except Exception as err:
return JsonResponse({'response': str(err)}, status=HTTPStatus.NOT_FOUND)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment