Fakultas Ilmu Komputer UI

Commit 193871a1 authored by Dwi Nanda Susanto's avatar Dwi Nanda Susanto
Browse files

deployed, add button reset item so that we dont have to always reset the db to test on the web

parent 5e84f3ee
db.sqlite3
geckodriver.log
__pycache__
*.pyc
......
File added
......@@ -17,6 +17,9 @@
{% endfor %}
</table>
<form action="reset-item/" method="GET">
<button type='submit'>RESET</button>
</form>
{% if items|length < 1 %}
<h3 style="color:green;">yey, waktunya berlibur</h3>
{% elif items|length > 0 and items|length < 5 %}
......
......@@ -10,4 +10,11 @@ def home_page(req):
return redirect('/')
items = Item.objects.all()
return render(req, 'home.html', {'items': items})
def reset_items(req):
if req.method == 'GET':
Item.objects.all().delete()
return redirect('/')
items = Item.objects.all()
return render(req, 'home.html', {'items': items})
\ No newline at end of file
Brotli==1.0.7
Django==1.11.24
Django==2.2.5
djangorestframework==3.10.3
gunicorn==19.9.0
pytz==2019.2
selenium==3.141.0
sqlparse==0.3.0
urllib3==1.25.3
whitenoise==3.3.1
......@@ -14,11 +14,14 @@ Including another URLconf
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.urls import path
from django.contrib import admin
from lists import views
app_name = 'lists'
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', views.home_page, name='home'),
path('reset-item/', views.reset_items),
]
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