Parcourir la source

ajout orientation des antennes

Élie Bouttier il y a 7 ans
Parent
commit
684781fb66
2 fichiers modifiés avec 26 ajouts et 0 suppressions
  1. 20 0
      services/migrations/0035_antenna_orientation.py
  2. 6 0
      services/models.py

+ 20 - 0
services/migrations/0035_antenna_orientation.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-06-15 11:30
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('services', '0034_auto_20170613_1327'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='antenna',
+            name='orientation',
+            field=models.IntegerField(blank=True, null=True, verbose_name='Orientation (°)'),
+        ),
+    ]

+ 6 - 0
services/models.py

@@ -160,6 +160,12 @@ class Antenna(models.Model):
             verbose_name='Adresse MAC')
             verbose_name='Adresse MAC')
     notes = models.TextField(blank=True)
     notes = models.TextField(blank=True)
     position = geo_models.PointField(null=True, blank=True)
     position = geo_models.PointField(null=True, blank=True)
+    orientation = models.IntegerField(verbose_name='Orientation (°)', null=True, blank=True)
+
+    def clean(self):
+        super().clean()
+        if self.orientation:
+            self.orientation = self.orientation % 360
 
 
     class Meta:
     class Meta:
         verbose_name = 'antenne'
         verbose_name = 'antenne'