diff --git a/apps/gto/migrations/0027_alter_gtoalarm_description.py b/apps/gto/migrations/0027_alter_gtoalarm_description.py new file mode 100644 index 0000000..43240d3 --- /dev/null +++ b/apps/gto/migrations/0027_alter_gtoalarm_description.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.25 on 2025-06-17 09:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gto', '0026_gtoalarm_description'), + ] + + operations = [ + migrations.AlterField( + model_name='gtoalarm', + name='description', + field=models.TextField(blank=True, choices=[('danger_zone_allow', 'Вход в опасную зону разрешен'), ('danger_zone_disallow', 'Вход в опасную зону запрещен'), ('communication_loss', 'Потеря связи'), ('Усталость водителя', 'Усталость водителя'), ('other', 'Прочие события')], null=True, verbose_name='Описание'), + ), + ] diff --git a/apps/gto/models/model_alarm.py b/apps/gto/models/model_alarm.py index 16822db..f77e1ae 100644 --- a/apps/gto/models/model_alarm.py +++ b/apps/gto/models/model_alarm.py @@ -7,7 +7,13 @@ from apps.gto.models.model_equipment import Equipment class GtoAlarm(models.Model): # События - + alarm_types = ( + ("danger_zone_allow", "Вход в опасную зону разрешен"), + ("danger_zone_disallow", "Вход в опасную зону запрещен"), + ("communication_loss", "Потеря связи"), + ("Усталость водителя", "Усталость водителя"), + ("other", "Прочие события"), + ) alarmid = models.IntegerField(help_text="", default=0, verbose_name="ID аларма") equipment = models.ForeignKey( Equipment, on_delete=models.SET_NULL, null=True, verbose_name="Объект" @@ -18,7 +24,7 @@ class GtoAlarm(models.Model): # События auto_now=False, auto_now_add=False, blank=True, verbose_name="Время события" ) alarm_type = models.CharField(max_length=50, blank=True, verbose_name="Тип события") - description = models.TextField(null=True, blank=True, verbose_name="Описание") + description = models.TextField(null=True, blank=True, verbose_name="Описание", choices=alarm_types) def getLat(self): return str(self.lat).replace(",", ".") diff --git a/apps/main/templates/main_index.html b/apps/main/templates/main_index.html index 79224e9..b0e14b3 100644 --- a/apps/main/templates/main_index.html +++ b/apps/main/templates/main_index.html @@ -69,7 +69,7 @@
{% if show_speed_excess %} -