diff --git a/README.md b/README.md index 7ecd9262a226525650933da88a61350e3a4c2339..c5023c25a6354a16856fe42b90104a529a75479c 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add/` with the fol * `image` : string of sourc image `.jpg` ### 5. To view a location list: -Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list` with the key `name`. <br> +Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list/`. <br> It will return a json list of locations with key: * `id` : id of location * `name` : location name @@ -83,7 +83,7 @@ It will return a json list of locations with key: * `image` : string of sourc image `.jpg` ### 6. To view a location details: -Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail/*nama_lokasi*` with the key `name`. <br> +Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail/*nama_lokasi*/`. <br> It will return a json with key: * `name` : location name * `altitude` : location altitude, a float. @@ -93,7 +93,7 @@ It will return a json with key: * `image` : string of source image `.jpg` ### 7. To register a facility: -Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nama-lokasi*` with the following key: +Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nama-lokasi*/` with the following key: * `tag` : Fasility Tag * The options are : * KURSI_RODA = 'KR' @@ -111,7 +111,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam * TEMPAT_PARKIR_BIASA = 'TB' * Put as a String separated by space - * example: "KR LF TD" + * example: `KR LF TD` <br> * `deskripsi` : Facility description. @@ -121,7 +121,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam <b>Add this to your request header. `Authorization` with value `token *your_token_from_request*`</b> ### 8. To see a facility list: -Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list-fasilitas/*nama-lokasi*` with `name` key. <br> +Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list-fasilitas/*nama-lokasi*/`. <br> It will return a json with the following key: * `id`: id of the facility * `nama_lokasi`: location name of the facility @@ -137,7 +137,7 @@ It will return a json with the following key: ### 9. To see a facility details: -Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail-fasilitas/*nama-lokasi*/id-fasilitas` with `name` key. <br> +Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail-fasilitas/*nama-lokasi*/*id-fasilitas*/`. <br> It will return a json with the following key: * `nama_lokasi`: location name of the facility * `deskripsi`: the description diff --git a/informasi_fasilitas/views.py b/informasi_fasilitas/views.py index 68b7566d51cee5101ffe7efb18b600b5c8378d97..55b47f2a6e4e7e96281b346f895162bc51fbc09f 100644 --- a/informasi_fasilitas/views.py +++ b/informasi_fasilitas/views.py @@ -104,11 +104,15 @@ def add_fasilitas(request, nama_lokasi): deskripsi = request.POST['deskripsi'] rating = request.POST['rating'] tag = request.POST['tag'].split() + image = "" + if 'image' in request.POST.keys(): + image = str(request.POST['image']) fasilitas = Fasilitas.objects.create(lokasi=lokasi, user=user, deskripsi=deskripsi, rating=rating, - tag=tag) + tag=tag, + image = image) return JsonResponse({'response' : 'fasilitas added', 'id':fasilitas.id}, status = 201) else: return JsonResponse({'response' : request_error_message("post")}, status = 400)