- Timestamp:
- Dec 28, 2008, 9:18:32 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/base.cfg
r6445 r6491 38 38 eggs = 39 39 Werkzeug 40 ipcalc41 # IPv4_Utils42 netaddr43 ipaddr44 40 pythonpath = 45 41 ${extras:location}/django-command-extensions/ -
trunk/exodus/admin.py
r6479 r6491 23 23 24 24 class InterfaceAdmin(ReadOnlyAdminFields, admin.ModelAdmin): 25 readonly = ('ip', 'netmask', 'mode', 'ssid', 'shortdesc', 'desc')25 readonly = ('ip', 'netmask', 'mode', 'ssid', ) 26 26 form = InterfaceForm 27 27 list_display = ('node', 'iface', 'type', 'ip', 'channel', 'polar', 28 ' shortdesc', 'link')28 'link') 29 29 search_fields = ('node__name','iface') 30 30 list_filter = ('type', 'accesspoint', 'polar', 'node', 'antenna') … … 34 34 'fields' : ('node', 'iface', 'type', ('ip', 'netmask'), 'link')}), 35 35 ('Wireless', { 36 'classes' : ('collapse', ), 36 37 'fields' : ('ssid', 'channel', 'antenna', 'polar', 'mode')}), 37 ('Description', { 38 'fields' : (('shortdesc', 'desc'))} 39 )) 38 ) 40 39 41 40 advanced_admin.register(Antenna) -
trunk/exodus/forms.py
r6479 r6491 52 52 "An ethernet interface can't have an antenna.") 53 53 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 54 63 55 64 def clean_link(self): … … 153 162 154 163 def clean_ip(self): 155 """Cleans the ip .164 """Cleans the ip and netmask. 156 165 157 166 We calculate the ipaddresses of this link and the ones linked to it. … … 247 256 return ip 248 257 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 26 26 ('mn', 'managed'), 27 27 ) 28 29 DIRECTION_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 28 41 29 42 class Antenna(models.Model): … … 95 108 polar = models.CharField(blank=True, max_length=10, choices=POLAR_CHOICES) 96 109 antenna = models.ForeignKey(Antenna, blank=True, null=True) 110 direction = models.CharField(max_length=10, blank=True, null=True, 111 choices=DIRECTION_CHOICES) 97 112 link = models.ForeignKey('self', blank=True, null=True) 98 113 ip = models.IPAddressField(unique=True, blank=True) … … 100 115 ssid = models.CharField(max_length=50, blank=True, null=True) 101 116 mode = models.CharField(max_length=10, choices=WIFI_MODE_CHOICES, 102 blank=True )117 blank=True, null=True) 103 118 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)106 119 107 120 class Meta: -
trunk/initial_data.json
r6431 r6491 669 669 "link": 1, 670 670 "mode": "", 671 "shortdesc": "2Rick2",672 671 "type": "eth", 673 672 "channel": null, 674 "d esc": "Ethernet naar Rick2"673 "direction": "" 675 674 } 676 675 }, … … 689 688 "link": 1, 690 689 "mode": "", 691 " shortdesc": "2Rick1",690 "direction": "", 692 691 "type": "eth", 693 "channel": null, 694 "desc": "Ethernet naar Rick1" 692 "channel": null 695 693 } 696 694 }, … … 709 707 "link": 3, 710 708 "mode": "ms", 711 " shortdesc": "11b",709 "direction": "", 712 710 "type": "11b", 713 "channel": 1, 714 "desc": "11b" 711 "channel": 1 715 712 } 716 713 }, … … 729 726 "link": 5, 730 727 "mode": "mn", 731 " shortdesc": "2 nwkerk",728 "direction": "", 732 729 "type": "11a", 733 "channel": 5, 734 "desc": "11a naar nieuwe kerk" 730 "channel": 5 735 731 } 736 732 }, … … 749 745 "link": 5, 750 746 "mode": "ms", 751 " shortdesc": "2 ick1",747 "direction": "", 752 748 "type": "11a", 753 "channel": 5, 754 "desc": "11a naar Rick1" 749 "channel": 5 755 750 } 756 751 }, … … 769 764 "link": 6, 770 765 "mode": "ms", 771 " shortdesc": "ap nwkerk",766 "direction": "", 772 767 "type": "11b", 773 "channel": 8, 774 "desc": "Ap voor de nieuwe kerk" 768 "channel": 8 775 769 } 776 770 }, … … 789 783 "link": 7, 790 784 "mode": "ms", 791 " shortdesc": "2rick1",785 "direction": "", 792 786 "type": "11b", 793 "channel": 1, 794 "desc": "wi0 naar nieuwe kerk en rick2" 787 "channel": 1 795 788 } 796 789 }, … … 809 802 "link": 7, 810 803 "mode": "mn", 811 " shortdesc": "2cope",804 "direction": "", 812 805 "type": "11g", 813 "channel": 1, 814 "desc": "Link naar Cope" 806 "channel": 1 815 807 } 816 808 }, … … 829 821 "link": 7, 830 822 "mode": "mn", 831 " shortdesc": "2cope",823 "direction": "", 832 824 "type": "11g", 833 "channel": 1, 834 "desc": "ath0 naar cope" 825 "channel": 1 835 826 } 836 827 }, … … 849 840 "link": 10, 850 841 "mode": "ms", 851 " shortdesc": "omni cope",842 "direction": "", 852 843 "type": "11g", 853 "channel": 7, 854 "desc": "omni van cope" 844 "channel": 7 855 845 } 856 846 }
Note:
See TracChangeset
for help on using the changeset viewer.