Changeset 6513
- Timestamp:
- Dec 30, 2008, 12:50:29 AM (16 years ago)
- Location:
- trunk/exodus
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/exodus/forms.py ¶
r6509 r6513 3 3 from exodus.wllogic import free_master_ip, link_has_compat_type, \ 4 4 link_is_wireless, new_ssid, new_ssid_for_existing_interface 5 from exodus.wllogic import MASTER, MANAGED, calc_subnet, network, show_addr 5 from exodus.wllogic import MASTER, MANAGED, calc_subnet, network, show_addr, \ 6 get_direction_choices 6 7 from exodus.settings import AP_NETMASK 7 8 from exodus.wlipcalc import IPCalc … … 55 56 i.ip = new_ip.ips.pop() 56 57 i.ssid = new_ssid(new_network, self.instance, i.iface, 57 i.accesspoint, i. direction)58 i.accesspoint, i.get_direction_display()) 58 59 for j in (j for j in all_links if not j.id == i.pk): 59 60 j.ip = new_ip.ips.pop() … … 288 289 i.save() 289 290 if link.accesspoint: 290 # Need to reverse because when i.save() happens 291 # the database might have an old ipaddress and unique==True 292 static = link.dhcpstatic_set.all() 293 for i in static.order_by('ipaddress').reverse(): 291 for i in link.dhcpstatic_set.all(): 294 292 i.ipaddress = new_ip.ips.pop() 295 293 i.save() … … 319 317 i.netmask = netmask 320 318 i.save() 321 static = link.dhcpstatic_set.all() 322 for i in static.order_by('ipaddress').reverse(): 319 for i in link.dhcpstatic_set.all(): 323 320 i.ipaddress = new_ip.ips.pop() 324 321 i.save() … … 358 355 iface = self.cleaned_data.get('iface') 359 356 accesspoint = self.cleaned_data.get('accesspoint') 360 direction = self.cleaned_data.get('direction')357 direction = get_direction_choices(self.cleaned_data.get('direction')) 361 358 link = self.cleaned_data.get('link') 362 359 orig_ssid = self.cleaned_data.get('ssid') -
TabularUnified trunk/exodus/models.py ¶
r6507 r6513 137 137 macaddress = models.CharField(max_length=17) 138 138 accesspoint = models.ForeignKey(Interface) 139 ipaddress = models.IPAddressField( unique=True,blank=True)139 ipaddress = models.IPAddressField(blank=True) 140 140 141 141 class Meta: -
TabularUnified trunk/exodus/wllogic.py ¶
r6496 r6513 1 1 # (c) Roland van Laar 2 2 3 from exodus.models import Node, WIFI_MODE_CHOICES 3 from exodus.models import Node, WIFI_MODE_CHOICES, DIRECTION_CHOICES 4 4 from exodus.settings import MASTERIP_NETMASK, WIRELESS, COMPAT 5 5 from math import ceil, log … … 9 9 MANAGED = WIFI_MODE_CHOICES[1][0] 10 10 11 def get_direction_choices(direction): 12 """Return the full direction given an abbreviation.""" 13 l = {} 14 for i in DIRECTION_CHOICES: 15 l[i[0]] = i[1] 16 return l[direction] 17 18 11 19 def new_ssid_for_existing_interface(nic): 20 """A parser that can be called in an easier way than new_ssid.""" 12 21 return new_ssid(nic.network,nic.node, nic.iface, nic.accesspoint, 13 nic. direction)22 nic.get_direction_dislay()) 14 23 15 24 def new_ssid(network, node, iface, accesspoint=False, direction=None): … … 32 41 return (ssid % ("")) 33 42 34 35 43 # compensate for the first AP. First AP ssid is: ap.nodename.network 36 44 # second AP is ap2.nodename.network
Note:
See TracChangeset
for help on using the changeset viewer.