Changeset 6479 for trunk


Ignore:
Timestamp:
Dec 23, 2008, 12:53:26 AM (16 years ago)
Author:
roland
Message:

Code cleanup, modified admin to be nicer when showing an interface.

Location:
trunk/exodus
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/exodus/admin.py

    r6437 r6479  
    2323
    2424class InterfaceAdmin(ReadOnlyAdminFields, admin.ModelAdmin):
    25     #readonly = ('ip', 'netmask', 'mode', 'ssid', 'shortdesc', 'desc')
     25    readonly = ('ip', 'netmask', 'mode', 'ssid', 'shortdesc', 'desc')
    2626    form = InterfaceForm
    2727    list_display = ('node', 'iface', 'type', 'ip', 'channel', 'polar',
     
    3030    list_filter = ('type', 'accesspoint', 'polar', 'node', 'antenna')
    3131    ordering =('node',)
     32    fieldsets = (
     33        (None, {
     34            'fields' : ('node', 'iface', 'type', ('ip', 'netmask'), 'link')}),
     35        ('Wireless', {
     36            'fields' : ('ssid', 'channel', 'antenna', 'polar', 'mode')}),
     37        ('Description', {
     38            'fields' : (('shortdesc', 'desc'))}
     39        ))
    3240
    3341advanced_admin.register(Antenna)
  • trunk/exodus/forms.py

    r6478 r6479  
    238238                    raise forms.ValidationError(
    239239                        "Not enough free ips for this node.")
    240                 import pdb; pdb.set_trace() ;
    241240                new_ip.ips.reverse()
    242241                ip = new_ip.ips.pop()
  • trunk/exodus/models.py

    r6477 r6479  
    106106   
    107107    class Meta:
    108         #unique_together = ('node', 'iface')
     108        unique_together = ('node', 'iface')
    109109        verbose_name = 'Interface'
    110110   
     
    115115        super(Interface, self).save(force_insert, force_update)
    116116        # If link is not defined we link to self.
    117         #XXX: need to assign an IP address in forms.
    118117        if not self.link:
    119118            self.link = self
    120119            super(Interface, self).save(False, True)
    121120       
    122 
    123 #
    124 # XXX: Currently not used, require rethinking wether we _really_ still needs
    125 # this feature as we going to use a new interlink IP naming model
    126 #class InterfaceAlias(models.Model):
    127 #    iface = models.ForeignKey(Interface,related_name='child')
    128 #    ip = models.IPAddressField(unique=True)
    129 #    netmask = models.IntegerField(default=30)
    130 #    shortdesc = models.CharField(blank=True, max_length=10)
    131 #    desc = models.CharField(blank=True, max_length=100)
    132 #    linkAlias = models.ForeignKey('self', blank=True, null=True)
    133 #    link = models.ForeignKey(Interface, blank=True, null=True)
    134 #   
    135 #    def __unicode__(self):
    136 #        return "Alias %s" % (self.iface)
    137 #
    138 #
    139 # XXX: Needs rethinking, dhcp[start|stop] could be removed if whole publicAP is
    140 # going to be activated as DHCP range, or only number of fixed clients needs to
    141 # be defined, all other could be calculated on the fly if needed
    142 
    143 #class PublicAP(models.Model):
    144 #     iface = models.ForeignKey(Interface,related_name='ap', verbose_name="interface")
    145 #     ip = models.IPAddressField(unique=True)
    146 #     netmask = models.IntegerField(default=28)
    147 #     dhcpstart = models.IPAddressField()
    148 #     dhcpstop = models.IPAddressField()
    149 #     shortdesc = models.CharField(max_length=10)
    150 #     desc = models.CharField(max_length=100)
    151 #
    152 #     class Meta:
    153 #         verbose_name = "Public Access Point"
    154 #
    155 #     def __unicode__(self):
    156 #         return "%s:%s" % (self.iface,self.pk)
    157121
    158122class DhcpStatic(models.Model):
     
    162126    public_accesspoint = models.ForeignKey(Interface)
    163127
    164 
    165128    class Meta:
    166129        verbose_name = "Static host"
Note: See TracChangeset for help on using the changeset viewer.