Verified Commit 7cbc97ec authored by Marco Marinello's avatar Marco Marinello
Browse files

Drop other hardware refs #678


Signed-off-by: Marco Marinello's avatarMarco Marinello <mmarinello@sezf.it>
parent b5930e90
......@@ -36,6 +36,7 @@
<input class="btn btn-lg btn-success" type="submit" value="{% trans 'Create' %}" />
{% else %}
<input class="btn btn-lg btn-warning" type="submit" value="{% trans 'Save' %}" />
<a class="btn btn-lg btn-danger" href="{% url 'drop_other_hardware' pk=object.pk %}">{% trans "Drop" %}</a>
{% endif %}
</form>
</div>
......
{% extends "base.html" %}{% load i18n %}
{% block content %}
<div class="jumbotron">
{% trans "Really delete" %} {{object}} ?
<form action="" method="POST">{% csrf_token %}
<input type="submit" class="btn btn-lg btn-danger" value="{% trans 'Yes' %}">
</form>
</div>
{% endblock %}
......@@ -18,6 +18,7 @@ urlpatterns = patterns('',
# The id in edit_activity url is the ACTIVITY id (we want to modify the xyz
# activity instance)
url(r'^edit_activity/(?P<id>[0-9]+)$', 'schools.views.edit_activity', name="edit_activity"),
url(r'^drop_other_hardware/(?P<pk>[0-9]+)$', v.DropOtherHardware.as_view(), name='drop_other_hardware'),
# The id in add_scrapbook url is the SCHOOL id
url(r'^add_scrapbook/(?P<id>[0-9]+)$', 'schools.views.add_scrapbook', name="add_school_scrapbook"),
url(r'^create_other_hardware/(?P<id>[0-9]+)$', 'schools.views.create_other_hardware', name="create_other_hardware"),
......
......@@ -16,7 +16,7 @@ from csvreports import CSVReport
from io import BytesIO
import json
from django.db.models import Max
from django.views.generic import ListView, CreateView
from django.views.generic import ListView, CreateView, DeleteView
from django.views.generic import UpdateView, DetailView
from octomon.mixins import UserMixin
import stats.models as stmodels
......@@ -228,6 +228,7 @@ def edit_other_hardware(request, hw):
'editing': True,
'school': school,
'form': otherhardwareform,
'object': hw
})
......@@ -439,3 +440,11 @@ def school_log(request):
return render(request, 'schools/school_log.html', {
'data': data
})
class DropOtherHardware(UserMixin, DeleteView):
model = smodels.OtherHardware
template_name = "schools/drop_hardware.html"
def get_success_url(self, **kw):
return reverse('school_detail', kwargs={'pk': self.object.school.pk})
Markdown is supported
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