Changeset 6524
- Timestamp:
- Dec 30, 2008, 11:01:23 PM (16 years ago)
- Location:
- trunk/exodus
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/exodus/templates/exodus-template.html ¶
r6441 r6524 18 18 <A class="menu" href="{% url advanced_admin exodus %}">Admin</a><br> 19 19 <A class="menu" href="{% url exodus.views.viewNodelist %}">Node List</a><br> 20 <A class="menu" href="{% url csvIndex %}">CSV Exports</a><br> 20 21 </div> 21 22 </td> -
TabularUnified trunk/exodus/templates/viewCSVlist.html ¶
-
Property svn:mergeinfo
set to
r6521 r6524 3 3 {% block content %} 4 4 5 <P class="blue"> Node List </P> 6 7 {% if nodes %} 5 <P class="blue"> CSV Export List </P> 8 6 <table border="3" cellpadding="1"> 9 {% for node in nodes %}10 7 <tr> 11 <td class="list" ><a class="list"href="{% url exodus.views.viewNode node.name %}">{{ node.name }}</a></td> 12 {% for configFile in configFiles %} 13 <td><a href="{% url exodus.views.configFile "freebsd-5.0" node.name configFile %}">{{ configFile }}</a></td> 14 {% endfor %} 8 <td class="list" ><a class="list" href="{% url exodus.views.viewNodesCSVlist %}">nodes.csv</a></td> 15 9 </tr> 16 17 {% endfor %} 10 <tr> 11 <td class="list" ><a class="list" href="{% url exodus.views.viewInterfacesCSVlist %}">interfaces.csv</a></td> 12 </tr> 18 13 </table> 19 {% else %}20 <p class="blue"> No nodes are available </p>21 {% endif %}22 23 14 {% endblock %} 24 15 -
Property svn:mergeinfo
set to
-
TabularUnified trunk/exodus/urls.py ¶
r6522 r6524 15 15 (r'^view/node/(?P<node>.+)/$', 'exodus.views.viewNode'), 16 16 (r'^nagios/$', 'exodus.views.nagios'), 17 18 # CSV 'export' views 19 url(r'^view/csv/$', 'exodus.urls.direct_to_template', {'template': 'viewCSVlist.html'}, "csvIndex"), 20 (r'^view/csv/nodes.csv$', 'exodus.views.viewNodesCSVlist'), 21 (r'^view/csv/interfaces.csv$', 'exodus.views.viewInterfacesCSVlist'), 17 22 18 23 # config urls -
TabularUnified trunk/exodus/views.py ¶
r6522 r6524 1 1 # (c) Roland van Laar 2006 2 2 3 import csv 4 from django.http import HttpResponse 3 5 from django.shortcuts import render_to_response 4 6 from django.template import RequestContext 5 7 from socket import gethostname 8 6 9 7 10 from exodus.models import Node … … 22 25 'resolv.conf' ) 23 26 return render_to_response('viewNodelist.html', {'nodes' : nodes, 24 'configFiles' : configFiles}) 27 'configFiles' : configFiles}) 28 29 def viewNodesCSVlist(request): 30 response = HttpResponse(mimetype='text/csv') 31 response['Content-Disposition'] = 'attachment; filename=nodes.csv' 32 nodes = Node.objects.all() 33 34 writer = csv.writer(response) 35 writer.writerow(['name', 'location', 'longitude', 'latitude', 'masterip']) 36 for node in nodes: 37 writer.writerow([node.name, node.location.description, node.location.longitude, node.location.latitude, node.masterip]) 38 39 return response 40 41 42 def viewInterfacesCSVlist(request): 43 response = HttpResponse(mimetype='text/csv') 44 response['Content-Disposition'] = 'attachment; filename=interfaces.csv' 45 nodes = Node.objects.all() 46 47 writer = csv.writer(response) 48 writer.writerow(["iface","node","type","ssid","channel","antenna","polar","direction","mode","ip","netmask","linknode", "linkiface"]) 49 for node in nodes: 50 for nic in node.interface_set.all(): 51 if nic == nic.link: 52 mode = 'master' 53 else: 54 mode = 'slave' 55 writer.writerow([nic.iface, node.name, nic.type, nic.ssid, nic.channel, 56 nic.antenna, nic.get_polar_display(), nic.get_direction_display(), 57 mode, nic.ip, nic.netmask, nic.link.node, nic.link.iface]) 58 return response 25 59 26 60 def configFile(request, version, node, file):
Note:
See TracChangeset
for help on using the changeset viewer.