Changeset 6491 for trunk


Ignore:
Timestamp:
Dec 28, 2008, 9:18:32 PM (16 years ago)
Author:
roland
Message:

Made a fix in models.py:
sdesc and desc were removed from the interface.
Added a direction option for wifilinks.

Added collapse option to wireless stuff in the interface admin.
Removed unnesessary eggs from base.cfg
Updated inititial_data.json to new database structure

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/base.cfg

    r6445 r6491  
    3838eggs =
    3939  Werkzeug
    40   ipcalc
    41 #  IPv4_Utils
    42   netaddr
    43   ipaddr
    4440pythonpath =
    4541  ${extras:location}/django-command-extensions/
  • trunk/exodus/admin.py

    r6479 r6491  
    2323
    2424class InterfaceAdmin(ReadOnlyAdminFields, admin.ModelAdmin):
    25     readonly = ('ip', 'netmask', 'mode', 'ssid', 'shortdesc', 'desc')
     25    readonly = ('ip', 'netmask', 'mode', 'ssid', )
    2626    form = InterfaceForm
    2727    list_display = ('node', 'iface', 'type', 'ip', 'channel', 'polar',
    28         'shortdesc', 'link')
     28        'link')
    2929    search_fields = ('node__name','iface')
    3030    list_filter = ('type', 'accesspoint', 'polar', 'node', 'antenna')
     
    3434            'fields' : ('node', 'iface', 'type', ('ip', 'netmask'), 'link')}),
    3535        ('Wireless', {
     36            'classes' : ('collapse', ),
    3637            'fields' : ('ssid', 'channel', 'antenna', 'polar', 'mode')}),
    37         ('Description', {
    38             'fields' : (('shortdesc', 'desc'))}
    39         ))
     38        )
    4039
    4140advanced_admin.register(Antenna)
  • trunk/exodus/forms.py

    r6479 r6491  
    5252                    "An ethernet interface can't have an antenna.")
    5353        return antenna
     54
     55    def clean_direction(self):
     56        self.type = self.cleaned_data.get('type')
     57        direction = self.cleaned_data.get('direction')
     58        if direction and not link_is_wireless(self):
     59            raise forms.ValidationError(
     60                    "An ethernet interface can't have a direction.")
     61        return direction
     62       
    5463
    5564    def clean_link(self):
     
    153162
    154163    def clean_ip(self):
    155         """Cleans the ip.
     164        """Cleans the ip and netmask.
    156165
    157166        We calculate the ipaddresses of this link and the ones linked to it.
     
    247256                return ip
    248257
    249     #XXX: change SSID when iface.name changes   
     258    def clean_netmask(self):
     259        """Cleaning happens in clean_ip."""
     260        return self.cleaned_data.get('netmask')
     261
     262    def clean_ssid(self):
     263        self.type = self.cleaned_data.get('type')
     264        if not link_is_wireless(self):
     265            return None
     266
     267
  • trunk/exodus/models.py

    r6481 r6491  
    2626         ('mn', 'managed'),
    2727         )
     28
     29DIRECTION_CHOICES = (
     30        ('n', 'north'),
     31        ('nw', 'north-west'),
     32        ('w', 'west'),
     33        ('sw', 'south-west'),
     34        ('s', 'south'),
     35        ('se', 'south-east'),
     36        ('e', 'east'),
     37        ('ne', 'north-east'),
     38        ('omni', 'omnidirectional'),
     39        )
     40
    2841
    2942class Antenna(models.Model):
     
    95108    polar = models.CharField(blank=True, max_length=10, choices=POLAR_CHOICES)
    96109    antenna = models.ForeignKey(Antenna, blank=True, null=True)
     110    direction = models.CharField(max_length=10, blank=True, null=True,
     111            choices=DIRECTION_CHOICES)
    97112    link = models.ForeignKey('self', blank=True, null=True)
    98113    ip = models.IPAddressField(unique=True, blank=True)
     
    100115    ssid = models.CharField(max_length=50, blank=True, null=True)
    101116    mode = models.CharField(max_length=10, choices=WIFI_MODE_CHOICES,
    102             blank=True)
     117            blank=True, null=True)
    103118    channel = models.IntegerField(blank=True, null=True)
    104     shortdesc = models.CharField(blank=True, max_length=10)
    105     desc = models.CharField(blank=True, max_length=100)
    106119   
    107120    class Meta:
  • trunk/initial_data.json

    r6431 r6491  
    669669   "link": 1,
    670670   "mode": "",
    671    "shortdesc": "2Rick2",
    672671   "type": "eth",
    673672   "channel": null,
    674    "desc": "Ethernet naar Rick2"
     673   "direction": ""
    675674  }
    676675 },
     
    689688   "link": 1,
    690689   "mode": "",
    691    "shortdesc": "2Rick1",
     690   "direction": "",
    692691   "type": "eth",
    693    "channel": null,
    694    "desc": "Ethernet naar Rick1"
     692   "channel": null
    695693  }
    696694 },
     
    709707   "link": 3,
    710708   "mode": "ms",
    711    "shortdesc": "11b",
     709   "direction": "",
    712710   "type": "11b",
    713    "channel": 1,
    714    "desc": "11b"
     711   "channel": 1
    715712  }
    716713 },
     
    729726   "link": 5,
    730727   "mode": "mn",
    731    "shortdesc": "2 nwkerk",
     728   "direction": "",
    732729   "type": "11a",
    733    "channel": 5,
    734    "desc": "11a naar nieuwe kerk"
     730   "channel": 5
    735731  }
    736732 },
     
    749745   "link": 5,
    750746   "mode": "ms",
    751    "shortdesc": "2 ick1",
     747   "direction": "",
    752748   "type": "11a",
    753    "channel": 5,
    754    "desc": "11a naar Rick1"
     749   "channel": 5
    755750  }
    756751 },
     
    769764   "link": 6,
    770765   "mode": "ms",
    771    "shortdesc": "ap nwkerk",
     766   "direction": "",
    772767   "type": "11b",
    773    "channel": 8,
    774    "desc": "Ap voor de nieuwe kerk"
     768   "channel": 8
    775769  }
    776770 },
     
    789783   "link": 7,
    790784   "mode": "ms",
    791    "shortdesc": "2rick1",
     785   "direction": "",
    792786   "type": "11b",
    793    "channel": 1,
    794    "desc": "wi0 naar nieuwe kerk en rick2"
     787   "channel": 1
    795788  }
    796789 },
     
    809802   "link": 7,
    810803   "mode": "mn",
    811    "shortdesc": "2cope",
     804   "direction": "",
    812805   "type": "11g",
    813    "channel": 1,
    814    "desc": "Link naar Cope"
     806   "channel": 1
    815807  }
    816808 },
     
    829821   "link": 7,
    830822   "mode": "mn",
    831    "shortdesc": "2cope",
     823   "direction": "",
    832824   "type": "11g",
    833    "channel": 1,
    834    "desc": "ath0 naar cope"
     825   "channel": 1
    835826  }
    836827 },
     
    849840   "link": 10,
    850841   "mode": "ms",
    851    "shortdesc": "omni cope",
     842   "direction": "",
    852843   "type": "11g",
    853    "channel": 7,
    854    "desc": "omni van cope"
     844   "channel": 7
    855845  }
    856846 }
Note: See TracChangeset for help on using the changeset viewer.