Skip to content

Commit

Permalink
update:tugas9
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsupilamieue committed Nov 18, 2023
1 parent cebefdd commit 820ad4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def login(request):
# Status login sukses.
return JsonResponse({
"username": user.username,
"id" : user.id,
"status": True,
"message": "Login sukses!"
# Tambahkan data lainnya jika ingin mengirim data ke Flutter.
Expand Down
1 change: 1 addition & 0 deletions main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
path('json/<int:id>/', show_json_by_id, name='show_json_by_id'),
path('html/<int:id>/', show_html_by_id, name='show_html_by_id'),
path('create-flutter/', create_item_flutter, name='create_item_flutter'),
path('jsonf/',show_json_user, name='show_json_user'),
]
4 changes: 4 additions & 0 deletions main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ def show_json(request):
data = Item.objects.all()
return HttpResponse(serializers.serialize("json", data), content_type="application/json")

def show_json_user(request):
data = Item.objects.filter(user = request.user)
return HttpResponse(serializers.serialize("json", data), content_type="application/json")

def show_html(request):
data = Item.objects.all()
return render(request, 'items.html', {'items': data})
Expand Down

0 comments on commit 820ad4a

Please sign in to comment.