From f66232ef48289411efa6bb456c0bd2464fc654eb Mon Sep 17 00:00:00 2001 From: Suhail vs Date: Wed, 5 Sep 2018 07:27:47 +0530 Subject: [PATCH] try to fix issue #993: provide provision for people to remove data in https://keralarescue.in/requests/?district= --- mainapp/models.py | 3 ++- mainapp/templates/mainapp/request_list.html | 3 ++- mainapp/views.py | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mainapp/models.py b/mainapp/models.py index 93a203cdd..9bde8d228 100644 --- a/mainapp/models.py +++ b/mainapp/models.py @@ -37,7 +37,8 @@ status_types =( ('new', 'New'), ('pro', 'In progess'), - ('sup', 'Supplied') + ('sup', 'Supplied'), + ('del', 'Deleted') ) volunteer_update_status_types = ( diff --git a/mainapp/templates/mainapp/request_list.html b/mainapp/templates/mainapp/request_list.html index 0510614ff..ac0818ed0 100644 --- a/mainapp/templates/mainapp/request_list.html +++ b/mainapp/templates/mainapp/request_list.html @@ -111,7 +111,8 @@

ഇതു വരെ ആവശ്യപ്പെട്ട {{ req.dateadded }} {{ req.dateadded|timesince }} More details - Update + Update | + {% bootstrap_icon "trash" %} {% endfor %} diff --git a/mainapp/views.py b/mainapp/views.py index 0b76491b0..f2cfccb16 100644 --- a/mainapp/views.py +++ b/mainapp/views.py @@ -360,6 +360,11 @@ def contributors(request): def request_list(request): + deleteitem = request.GET.get('deleteitem','') + if deleteitem: + item = Request.objects.get(id=deleteitem) + item.status = 'del' + item.save() filter = RequestFilter(request.GET, queryset=Request.objects.exclude(status='sup') ) req_data = filter.qs.order_by('-id') paginator = Paginator(req_data, PER_PAGE) @@ -941,3 +946,4 @@ class CollectionCenterView(CreateView): model = CollectionCenter form_class = CollectionCenterForm success_url = '/collection_centers/' + \ No newline at end of file