From 82853de7fdc775716f283612d6b897ad33713cde Mon Sep 17 00:00:00 2001 From: zakhy <=> Date: Tue, 21 Jan 2025 11:27:10 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D0=B5=D0=BB=D1=8C=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B8=D0=BA=D0=BE=D0=BD=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/gto/admin.py | 8 ++++++- apps/gto/migrations/0013_modeltypeicons.py | 25 ++++++++++++++++++++++ apps/gto/models/model_type_icons.py | 13 +++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 apps/gto/migrations/0013_modeltypeicons.py create mode 100644 apps/gto/models/model_type_icons.py diff --git a/apps/gto/admin.py b/apps/gto/admin.py index 5d6e8e6..a541d2e 100644 --- a/apps/gto/admin.py +++ b/apps/gto/admin.py @@ -1,6 +1,7 @@ from django.contrib import admin from .models.model_equipment import Equipment +from .models.model_type_icons import ModelTypeIcons from .models.model_type_sensor import TypeSensor from .models.model_sensors import Sensors from .models.model_indicators import Indicators @@ -40,4 +41,9 @@ class GtoAlarmAdmin(admin.ModelAdmin): @admin.register(EquipmentTracking) class EquipmentTrackingAdmin(admin.ModelAdmin): ordering = ('eventid',) - list_display = ('eventid','equipment','time','lat','lon','speed') \ No newline at end of file + list_display = ('eventid','equipment','time','lat','lon','speed') + + +@admin.register(ModelTypeIcons) +class ModelTypeIconsAdmin(admin.ModelAdmin): + pass diff --git a/apps/gto/migrations/0013_modeltypeicons.py b/apps/gto/migrations/0013_modeltypeicons.py new file mode 100644 index 0000000..ceac7ca --- /dev/null +++ b/apps/gto/migrations/0013_modeltypeicons.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.25 on 2025-01-21 04:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gto', '0012_alter_equipmenttracking_eventid'), + ] + + operations = [ + migrations.CreateModel( + name='ModelTypeIcons', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('model', models.CharField(max_length=128)), + ('path', models.CharField(max_length=256)), + ], + options={ + 'verbose_name': 'Иконка оборудования', + 'verbose_name_plural': 'Иконки оборудования', + }, + ), + ] diff --git a/apps/gto/models/model_type_icons.py b/apps/gto/models/model_type_icons.py new file mode 100644 index 0000000..6f18f18 --- /dev/null +++ b/apps/gto/models/model_type_icons.py @@ -0,0 +1,13 @@ +from django.db import models + + +class ModelTypeIcons(models.Model): + model = models.CharField(max_length=128) + path = models.CharField(max_length=256) + + def __str__(self): + return self.model + + class Meta: # отображение в админики + verbose_name = u'Иконка оборудования' + verbose_name_plural = u'Иконки оборудования'