Changeset 6288
Legend:
- Unmodified
- Added
- Removed
-
exodus/models.py
r6287 r6288 91 91 link = models.ForeignKey('self', blank=True, null=True) 92 92 93 class Meta: 94 unique_together = ('node', 'iface') 95 93 96 def __str__(self): 94 97 return "%s:%s" % (self.node.name, self.iface) -
exodus/templates/node-detail.html
r6287 r6288 15 15 16 16 <h2>Interfaces</h2> 17 <a href="{% url exodus.views.addInterface %}?node={{ object.name }}">Add new interface</a> 17 18 18 19 {% for nic in object.interface_set.all %} -
exodus/urls.py
r6287 r6288 43 43 (r'^add/node/$', 'exodus.views.addNode'), 44 44 (r'^add/nic/$', 'exodus.views.addInterface'), 45 (r'^add/interlink/$', 'exodus.views.addLink'), 46 (r'^add/omni/$', 'exodus.views.addPublicAP'), 45 (r'^add/dhcp/$', 'exodus.views.addPublicAP'), 47 46 48 47 # add urls … … 51 50 (r'^edit/nic/(?P<objectId>.+)/$', 'exodus.views.editInterface'), 52 51 (r'^edit/interlink/(?P<object_id>.+)/$', 'exodus.views.addLink'), 53 (r'^edit/ omni/(?P<object_id>.+)/$', 'exodus.views.addPublicAP'),52 (r'^edit/dhcp/(?P<object_id>.+)/$', 'exodus.views.addPublicAP'), 54 53 55 54 # delete/remove urls -
exodus/views.py
r6287 r6288 40 40 instance.masterip = freemasterip() 41 41 instance.save() 42 return HttpResponseRedirect( "/exodus/")42 return HttpResponseRedirect(reverse('nodelist')) 43 43 else: 44 44 form = AddNodeForm() … … 53 53 #Properly redirect to view/<Node> needed 54 54 message = 'Node Updated succesfully' 55 return HttpResponseRedirect( "/exodus/")55 return HttpResponseRedirect(reverse('node-detail', args=[objectId])) 56 56 else: 57 57 message = 'Form error, please edit and resubmit' … … 70 70 instance.masterip = freemasterip() 71 71 instance.save() 72 return HttpResponseRedirect( "/exodus/")72 return HttpResponseRedirect(reverse('nodelist')) 73 73 else: 74 74 form = AddNodeForm() … … 97 97 if form.is_valid(): 98 98 saveInterface(form) 99 return HttpResponseRedirect("/exodus/") 99 nodeName = Node.objects.get(pk=request.POST['node' ]).name 100 return HttpResponseRedirect(reverse('node-detail', args=[nodeName])) 100 101 else: 101 102 #XXX: Link, master interfaces only 102 form = addInterfaceForm() 103 if 'node' in request.GET: 104 newInterface = Interface() 105 newInterface.node = Node.objects.get(name=request.GET['node']) 106 form = addInterfaceForm(instance=newInterface) 107 else: 108 form = addInterfaceForm() 103 109 return render_to_response('addnic.html', {'form': form }) 104 110 … … 110 116 if form.is_valid(): 111 117 saveInterface(form) 112 return HttpResponseRedirect( "/exodus/")118 return HttpResponseRedirect(reverse('node-detail', args=[nodeName])) 113 119 else: 114 120 #XXX: Link, master interfaces only … … 148 154 if compatibleInterfaces and differentNodes: 149 155 instance.save() 150 return HttpResponseRedirect( "/exodus/")156 return HttpResponseRedirect(reverse('nodelist')) 151 157 else: 152 158 form = addLinkForm(instance = instance) … … 181 187 instance.ssid = newSSIDName(instance.iface.node, instance.iface, 'omni') 182 188 instance.save() 183 return HttpResponseRedirect( "/exodus/")189 return HttpResponseRedirect(reverse('nodelist')) 184 190 else: 185 191 form = addPublicAPForm()
Note:
See TracChangeset
for help on using the changeset viewer.