Skip to content

Commit

Permalink
Merge pull request #8 from fathonidf/development
Browse files Browse the repository at this point in the history
selesai tutorial 5 dan bonus
  • Loading branch information
fathonidf authored Oct 4, 2023
2 parents 8506bdf + fe1a52c commit 5e60350
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions main/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,17 @@ <h5>Sesi terakhir login: {{ last_login }}</h5>
<th>Price</th>
<th>Description</th>
<th>Date Added</th>
<th>Edit Product</th>
<th>Delete</th>
</tr>`
products.forEach((item) => {
htmlString += `\n<tr>
<td>${item.fields.name}</td>
<td>${item.fields.price}</td>
<td>${item.fields.description}</td>
<td>${item.fields.date_added}</td>
<td><a href="edit_product/${item.pk}"><button>Edit</button></a></td>
<td><a href="delete/${item.pk}"><button>Delete</button></a></td>
</tr>`
})

Expand Down
2 changes: 1 addition & 1 deletion main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def show_main(request):
'name': request.user.username,
'class': 'PBP E',
'products': products,
'last_login': request.COOKIES['last_login']
'last_login': request.COOKIES.get('last_login')
}
return render(request, "main.html", context)

Expand Down

0 comments on commit 5e60350

Please sign in to comment.