- Timestamp:
- Sep 30, 2008, 10:07:52 PM (16 years ago)
- Location:
- trunk/exodus
- Files:
-
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/models.py
r6317 r6320 123 123 124 124 def __str__(self): 125 return "%s " % (self.shortdesc)125 return "%s:%s" % (self.iface,self.pk) 126 126 127 127 class DhcpStatic(models.Model): -
trunk/exodus/templates/delomni.html
-
Property svn:mergeinfo
set to
r6316 r6320 3 3 {% block content %} 4 4 5 <h1>Delete node {{ object.name }}</h1> 6 7 Interfaces to be deleted: 8 <ol> 9 {% for nic in object.interface_set.all %} 10 <li>{{ nic }}</li> 11 {% endfor %} 12 </ol> 13 14 All connected interfaces to be converted to master interfaces: 15 <ol> 16 {% for nic in object.interface_set.all %} 17 {% ifequal nic.link nic %} 18 {% for interlink in nic.link.interface_set.all %} 19 {% ifnotequal interlink nic %} 20 <li> {{ interlink }}</li> 21 {% endifnotequal %} 22 {% endfor %} 23 {% endifequal %} 24 {% endfor %} 25 </ol> 5 <h1>Delete Public Access Point {{ object.name }}</h1> 26 6 27 7 <form method="post" action="."> -
Property svn:mergeinfo
set to
-
trunk/exodus/templates/exodus-template.html
r6317 r6320 11 11 <TR> 12 12 <td class="menu" valign="top"> 13 <div style="min-height:400px"> 13 14 <A name="top"><img width="130" height="82" alt="logo" src="{% url static path="logo.png" %}" border=0></A><br> 14 15 <img width="130" height="97" alt="foto" src="{% url static path="foto.jpg" %}"/><br> … … 17 18 <A class="menu" href="{% url exodus.views.addLocation %}">Add Location</a><br> 18 19 <A class="menu" href="{% url exodus.views.addNode %}">Add Node</a><br> 20 </div> 19 21 </td> 20 22 <td valign="top" class="right"> -
trunk/exodus/templates/node-detail.html
r6317 r6320 5 5 6 6 <div style="border:1px solid #000000;"> 7 <h1> {{ object.name }} </h1>7 <h1> {{ node.name }} </h1> 8 8 <h3> Location </h3> 9 Description: {{ object.location.description }} <br>10 Longitude: {{ object.location.longitude }} <br>11 Latitude: {{ object.location.latitude }} <br>9 Description: {{ node.location.description }} <br> 10 Longitude: {{ node.location.longitude }} <br> 11 Latitude: {{ node.location.latitude }} <br> 12 12 13 Master ip: {{ object.masterip }} <br>14 <a href="{% url exodus.views.editNode object%}">EDIT</a>15 <a href="{% url exodus.views.delNode object%}">DELETE</a>13 Master ip: {{ node.masterip }} <br> 14 <a href="{% url exodus.views.editNode node %}">EDIT</a> 15 <a href="{% url exodus.views.delNode node %}">DELETE</a> 16 16 </div> 17 17 18 18 <h2>Interfaces</h2> 19 <a href="{% url exodus.views.addInterface %}?node={{ object.name }}">Add new interface</a><p />19 <a href="{% url exodus.views.addInterface %}?node={{ node.name }}">Add new interface</a><p /> 20 20 21 {% for nic in object.interface_set.all %} 21 {% for nic in node.interface_set.all %} 22 <div style="border:1px solid #000000;"> 22 23 <div style="border:1px solid #000000;"> 23 24 <h3>iface: {{ nic.iface }} </h3> … … 51 52 {% endifnotequal %} 52 53 {% endfor %} 53 54 <ul> 54 <ol> 55 55 {% for accessPoint in nic.ap.all %} 56 56 <div style="border:1px solid #000000;"> 57 57 <p /> 58 58 <li>Public Access Point: {{ accessPoint.ip}}/{{accessPoint.netmask }} 59 <a href="{% url exodus.views.editPublicAP node.name nic.iface accessPoint.pk %}">EDIT</a> 60 <a href="{% url exodus.views.delPublicAP accessPoint %}">DELETE</a> 59 61 {% for dhcp in accessPoint.dhcpstatic.all %} 60 62 <ul> … … 67 69 </div> 68 70 {% endfor %} 69 </ul> 71 </ol> 72 </div> 73 <p /> 70 74 {% endfor %} 71 75 -
trunk/exodus/urls.py
r6315 r6320 30 30 url(r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'index.html'}, "root") , 31 31 url(r'^nodelist/$', 'django.views.generic.list_detail.object_list', dict(node_dict, template_name='node-list.html'), "nodelist"), 32 url(r'^view/node/(?P< slug>.+)/$', 'django.views.generic.list_detail.object_detail', dict(node_dict,slug_field='name',template_name='node-detail.html'), "node-detail"),32 url(r'^view/node/(?P<node>.+)/$', 'exodus.views.node', {}, "node-detail"), 33 33 34 34 # config urls … … 50 50 (r'^edit/nic/(?P<objectId>.+)/$', 'exodus.views.editInterface'), 51 51 (r'^edit/link/(?P<object_id>.+)/$', 'exodus.views.addLink'), 52 (r'^edit/dhcp/(?P< object_id>.+)/$', 'exodus.views.addPublicAP'),52 (r'^edit/dhcp/(?P<node>.+)/(?P<interface>.+)/(?P<publicAP>.+)/$', 'exodus.views.editPublicAP'), 53 53 54 54 # delete/remove urls 55 55 (r'^delete/node/(?P<objectId>.+)/$', 'exodus.views.delNode'), 56 56 (r'^delete/nic/(?P<objectId>.+)/$', 'exodus.views.delInterface'), 57 (r'^delete/dhcp/(?P<objectId>.+)/$', 'exodus.views.delPublicAP'), 57 58 ) 58 59 -
trunk/exodus/views.py
r6317 r6320 31 31 model = Node 32 32 exclude = ( 'masterip' ) 33 34 def node(request, node): 35 object = Node.objects.get(name=node) 36 return render_to_response('node-detail.html', {'node': object}) 33 37 34 38 def addNode(request): … … 200 204 return render_to_response('addinterlink.html',{'form': form}) 201 205 202 class addPublicAPForm(forms.ModelForm):206 class AddPublicAPForm(forms.ModelForm): 203 207 class Meta: 204 208 model = PublicAP … … 207 211 def addPublicAP(request): 208 212 if request.POST: 209 form = addPublicAPForm(request.POST)213 form = AddPublicAPForm(request.POST) 210 214 if form.is_valid(): 211 215 instance = form.save(commit=False) … … 225 229 newPublicAP = PublicAP() 226 230 newPublicAP.iface = Interface.objects.get(iface=interfaceName, node=nodename2id(nodeName)) 227 form = addPublicAPForm(instance=newPublicAP)228 else: 229 form = addPublicAPForm()231 form = AddPublicAPForm(instance=newPublicAP) 232 else: 233 form = AddPublicAPForm() 230 234 return render_to_response('addomni.html', {'form': form }) 235 236 def editPublicAP(request, node, interface, publicAP): 237 nodeID = Node.objects.get(name=node) 238 iface = Interface.objects.get(node=nodeID, iface=interface) 239 publicAP = PublicAP.objects.get(iface=iface, pk=publicAP) 240 if request.POST: 241 form = AddPublicAPForm(request.POST, instance=publicAP) 242 if form.is_valid(): 243 form.save() 244 #Properly redirect to view/<Node> needed 245 message = 'Node Updated succesfully' 246 node = publicAP.iface.node 247 return HttpResponseRedirect(reverse('node-detail', args=[node])) 248 else: 249 message = 'Form error, please edit and resubmit' 250 else: 251 message = 'Please edit and submit' 252 form = AddPublicAPForm(instance=publicAP) 253 return render_to_response('addnode.html', {'form': form, 'message' : message }) 254 255 def delPublicAP(request, objectId): 256 publicAP = PublicAP.objects.get(name=objectId) 257 node = publicAP.iface.node 258 if request.POST.has_key('cancel'): 259 return HttpResponseRedirect(reverse('node-detail', args=[node])) 260 elif request.POST.has_key('proceed'): 261 publicAP.delete() 262 return HttpResponseRedirect(reverse('node-detail', args=[node])) 263 else: 264 return render_to_response('delomni.html', {'object': publicAP }) 231 265 232 266 def nodename2id(node):
Note:
See TracChangeset
for help on using the changeset viewer.