Changeset 9818 for src/django_gheat/gheat/models.py
- Timestamp:
- Dec 23, 2011, 8:28:57 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/models.py
r9747 r9818 7 7 MAX_SIGNAL = 100 8 8 9 ACCESPOINT_TYPE_CHOICES= ( 10 ('accespoint', 'Acess Point'), 11 ('interlink', 'InterLink'), 12 ) 9 13 10 14 # http://stackoverflow.com/questions/849142/how-to-limit-the-maximum-value-of-a-numeric-field-in-a-django-model/849426#849426 … … 71 75 mac = models.CharField(max_length=17) 72 76 ssid = models.CharField(max_length=64) 77 type = models.CharField(max_length=20, null=True, blank=True, choices=ACCESPOINT_TYPE_CHOICES) 73 78 organization = models.ForeignKey(Organization,null=True, blank=True) 74 79 encryptie = models.BooleanField() … … 78 83 return "%s - %s" % (self.mac, self.ssid) 79 84 85 @staticmethod 86 def get_type_by_ssid(ssid): 87 if ssid.startswith('ap'): 88 type = 'accespoint' 89 elif ssid.startswith('il'): 90 type = 'interlink' 91 else: 92 type = None 93 return type 80 94 81 95 def save(self, *args, **kwargs): 82 self.organization = self.get_organization(self.ssid)83 96 super(Accespoint, self).save(*args, **kwargs) 84 97
Note:
See TracChangeset
for help on using the changeset viewer.