Browse Source

ajout orientation des antennes

Élie Bouttier 7 years ago
parent
commit
684781fb66
2 changed files with 26 additions and 0 deletions
  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')
     notes = models.TextField(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:
         verbose_name = 'antenne'