Author: sevein
Date: Sat Oct 2 14:24:49 2010
New Revision: 11
Log:
Add delete button/action.
Modified:
trunk/chk4upd/views.py
trunk/templates/base.html
trunk/templates/report.html
trunk/urls.py
Modified: trunk/chk4upd/views.py
==============================================================================
--- trunk/chk4upd/views.py Sat Oct 2 12:43:16 2010 (r10)
+++ trunk/chk4upd/views.py Sat Oct 2 14:24:49 2010 (r11)
@@ -2,7 +2,7 @@
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
import django.contrib.auth
-from django.shortcuts import render_to_response
+from django.shortcuts import render_to_response, get_object_or_404
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from qubitupdatecheck.chk4upd.models import Call
@@ -58,6 +58,15 @@
return render_to_response('report.html', locals())
@login_required
+def delete(request, id):
+
+ call = get_object_or_404(Call, id=id)
+
+ call.delete()
+
+ return HttpResponseRedirect('/report')
+
+...@login_required
def gethostbyaddr(request):
import socket
Modified: trunk/templates/base.html
==============================================================================
--- trunk/templates/base.html Sat Oct 2 12:43:16 2010 (r10)
+++ trunk/templates/base.html Sat Oct 2 14:24:49 2010 (r11)
@@ -30,6 +30,7 @@
table#report tr.odd { background-color: #87ceed; }
table#report a { color: Blue; }
table#report td.date { text-align: center; font-weight: bold; }
+ table#report .buttons { text-align: center; padding-left: 3px;
padding-right: 3px; }
div.pagination { margin: 10px auto 0 auto; text-align: center; color:
White; }
Modified: trunk/templates/report.html
==============================================================================
--- trunk/templates/report.html Sat Oct 2 12:43:16 2010 (r10)
+++ trunk/templates/report.html Sat Oct 2 14:24:49 2010 (r11)
@@ -12,7 +12,7 @@
{
$('td.httpmeta_remoteaddr a').click(function()
{
- jQuery.get('/qubitUpdateCheck/gethostbyaddr/', { ip:
jQuery(this).text() }, function(data) { alert(data); });
+ jQuery.get('/gethostbyaddr/', { ip: jQuery(this).text() },
function(data) { alert(data); });
});
});
</script>
@@ -27,6 +27,7 @@
<th>Version</th>
<th>Address</th>
<th>HTTP <abbr title="Remote Address">RA</abbr></th>
+ <th class="buttons"> </th>
</tr>
{% for item in objects.object_list %}
<tr class="{% cycle 'odd' 'even' %}">
@@ -36,6 +37,7 @@
<td>{{ item.version }} (» {{ item.version_offered }})</td>
<td><span title="{{ item.address }}">{{
item.address|truncate_chars:60 }}</span></td>
<td class="httpmeta_remoteaddr"><a href="#">{{
item.httpmeta_remoteaddr }}</a></td>
+ <td class="buttons"><a href="{% url chk4upd.views.delete item.id
%}"><img src="/media/delete.png" alt="Delete" onclick="return confirm('Are you
sure?');" /></a></td>
</tr>
{% endfor %}
</table>
Modified: trunk/urls.py
==============================================================================
--- trunk/urls.py Sat Oct 2 12:43:16 2010 (r10)
+++ trunk/urls.py Sat Oct 2 14:24:49 2010 (r11)
@@ -1,5 +1,5 @@
from django.conf.urls.defaults import *
-from chk4upd.views import check, report, index, gethostbyaddr, logout
+from chk4upd.views import check, report, index, gethostbyaddr, logout, delete
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
@@ -22,4 +22,5 @@
(r'^login/$', 'django.contrib.auth.views.login', {'template_name':
'login.html'}),
(r'^logout/$', logout),
(r'^report/$', report),
+ (r'^delete/(?P<id>\d+)/$', delete),
)
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.