Changeset 6321 for trunk


Ignore:
Timestamp:
Oct 1, 2008, 2:02:15 PM (16 years ago)
Author:
RIck van der Zwet
Message:

Use combination of default/javascript to allow a more logical workflow for the user

Location:
trunk/exodus
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/exodus/models.py

    r6320 r6321  
    7878class Interface(models.Model):
    7979        node = models.ForeignKey(Node)
    80         type = models.CharField(max_length=10, choices=INTERFACE_TYPE_CHOICES)
    81         iface = models.CharField(max_length=10, verbose_name="interface")
     80        type = models.CharField(max_length=10, choices=INTERFACE_TYPE_CHOICES, default=1)
     81        iface = models.CharField(max_length=10, verbose_name="interface", default='eth0')
    8282        ip = models.IPAddressField(unique=True)
    8383        netmask = models.IntegerField(default=30)
  • trunk/exodus/templates/addnic.html

    r6287 r6321  
    1010</form>
    1111
     12<script type="text/javascript">
     13window.onload = function()
     14{
     15        document.getElementById('id_polar').disabled = 'true';
     16        document.getElementById('id_antenna').disabled = 'true';
     17        document.getElementById('id_type').onchange = function()
     18        {
     19        var newValue = document.getElementById('id_type').value;
     20        document.getElementById('id_iface').value = newValue;
     21        if (newValue == 'eth') {
     22                newValue = 'true';
     23        } else {
     24                newValue = '';
     25        }
     26        document.getElementById('id_polar').disabled = newValue;
     27        document.getElementById('id_antenna').disabled = newValue;
     28        }
     29}
     30</script>
     31
     32
    1233{% endblock %}
Note: See TracChangeset for help on using the changeset viewer.