Модель для хранения иконок

This commit is contained in:
zakhy 2025-01-21 11:27:10 +07:00
parent 6e71748c2d
commit 82853de7fd
3 changed files with 45 additions and 1 deletions

View File

@ -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')
list_display = ('eventid','equipment','time','lat','lon','speed')
@admin.register(ModelTypeIcons)
class ModelTypeIconsAdmin(admin.ModelAdmin):
pass

View File

@ -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': 'Иконки оборудования',
},
),
]

View File

@ -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'Иконки оборудования'