Fakultas Ilmu Komputer UI

Commit dc14f8bc authored by Christopher Samuel's avatar Christopher Samuel
Browse files

Merge branch 'dev-samuel-2' into 'development'

[CHORES] Add default query for search kegiatan

See merge request !59
parents 5adbfdaa 357d4bcf
Pipeline #79774 passed with stages
in 9 minutes and 55 seconds
...@@ -39,6 +39,9 @@ urlpatterns = [ ...@@ -39,6 +39,9 @@ urlpatterns = [
path('lokasi/kegiatan-terdekat', path('lokasi/kegiatan-terdekat',
views_kegiatan.nearest_kegiatan, name='nearest-kegiatan'), views_kegiatan.nearest_kegiatan, name='nearest-kegiatan'),
path('lokasi/search-kegiatan',
views_kegiatan.search_kegiatan, name='search-kegiatan'),
path('lokasi/search-kegiatan/<str:query>', path('lokasi/search-kegiatan/<str:query>',
views_kegiatan.search_kegiatan, name='search-kegiatan'), views_kegiatan.search_kegiatan, name='search-kegiatan'),
......
...@@ -98,7 +98,7 @@ def list_foto_kegiatan(request, place_id, kegiatan_id): ...@@ -98,7 +98,7 @@ def list_foto_kegiatan(request, place_id, kegiatan_id):
@api_view(['GET']) @api_view(['GET'])
@authentication_classes([]) @authentication_classes([])
@permission_classes([]) @permission_classes([])
def search_kegiatan(request, query): def search_kegiatan(request, query=''):
query_by_nama = Kegiatan.objects.filter(nama_kegiatan__icontains=query) query_by_nama = Kegiatan.objects.filter(nama_kegiatan__icontains=query)
query_by_deskripsi = Kegiatan.objects.filter(deskripsi__icontains=query) query_by_deskripsi = Kegiatan.objects.filter(deskripsi__icontains=query)
query_by_penyelenggara = Kegiatan.objects.filter(penyelenggara__icontains=query) query_by_penyelenggara = Kegiatan.objects.filter(penyelenggara__icontains=query)
......
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