Parcourir la source

add a contact to antennas

Élie Bouttier il y a 7 ans
Parent
commit
d018c66fd2
3 fichiers modifiés avec 24 ajouts et 0 suppressions
  1. 1 0
      services/admin.py
  2. 22 0
      services/migrations/0038_antenna_contact.py
  3. 1 0
      services/models.py

+ 1 - 0
services/admin.py

@@ -381,6 +381,7 @@ class AntennaAdmin(geo_admin.OSMGeoAdmin):
         AntennaPrefixFilter,
     )
     search_fields = ('=id', 'label', 'notes',)
+    raw_id_fields = ('contact',)
 
     def get_queryset(self, request):
         qs = super().get_queryset(request)

+ 22 - 0
services/migrations/0038_antenna_contact.py

@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-09-02 19:40
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('adhesions', '0016_adhesion_membership'),
+        ('services', '0037_auto_20170707_1311'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='antenna',
+            name='contact',
+            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adhesions.Adhesion'),
+        ),
+    ]

+ 1 - 0
services/models.py

@@ -156,6 +156,7 @@ class Antenna(models.Model):
                 RegexValidator(r'^([0-9a-fA-F]{2}([:-]?|$)){6}$'),
             ],
             verbose_name='Adresse MAC')
+    contact = models.ForeignKey(Adhesion, null=True, blank=True)
     notes = models.TextField(blank=True)
     position = geo_models.PointField(null=True, blank=True)
     orientation = models.IntegerField(verbose_name='Orientation (°)', null=True, blank=True)