Fakultas Ilmu Komputer UI

Commit 0a604210 authored by Dwi Nanda Susanto's avatar Dwi Nanda Susanto
Browse files

Merge branch 'hotfix_reset_button' into 'master'

hotfix reset button when item is not exist, modify views on viewlist returning...

See merge request !20
parents 6511fe0d d19ad909
Pipeline #28455 passed with stages
in 37 minutes and 55 seconds
No preview for this file type
......@@ -46,9 +46,6 @@
</div>
</div>
<form action="reset_items/" method="GET" style="text-align:center;">
<button type='submit'>RESET ITEM</button>
</form>
<div class="footer">
<p id="footer" style="text-align:center;">Dwi Nanda S</p>
</div>
......
......@@ -10,6 +10,13 @@
</table>
<h2 id="text"> {{ text }} </h2>
{% if item_length < 1 %}
<form action="reset_items/" method="GET" style="text-align:center;display:none;">
{% else %}
<form action="reset_items/" method="GET" style="text-align:center;">
{% endif %}
<button type='submit'>RESET ITEM</button>
</form>
{% endblock %}
\ No newline at end of file
......@@ -18,7 +18,7 @@ def view_list(request, list_id):
else:
text = 'oh tidak'
return render(request, 'list.html', {'list': list_, 'text': text})
return render(request, 'list.html', {'list': list_, 'text': text, 'item_length': item_length})
def new_list(request):
list_ = List.objects.create()
......@@ -30,9 +30,7 @@ def add_item(request, list_id):
Item.objects.create(text=request.POST['item_text'], list=list_)
return redirect(f'/lists/{list_.id}/')
def reset_items(request, list_id):
print("AAAAAAAAAAAAAAAAA----")
def reset_items(request, list_id):
if request.method == 'GET':
Item.objects.all().delete()
return redirect('/')
......
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