test/apps/gto/models/model_indicators.py
zakhy 8c4f160253 Форматирование кода под PEP8
Не убраны неиспользованные импорты
2025-02-26 11:50:11 +07:00

33 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
from django.db import models
from django.urls import \
reverse # Used to generate URLs by reversing the URL patterns
from apps.gto.models.model_equipment import Equipment
from apps.gto.models.model_sensors import Sensors
class Indicators(models.Model): # Датчики
sensor = models.ForeignKey(
Sensors, on_delete=models.SET_NULL, null=True, verbose_name="Сенсор"
)
time = models.DateTimeField(
auto_now=False, auto_now_add=False, blank=True, verbose_name="Время показания"
)
value = models.FloatField(default=0.0, help_text="", verbose_name="Значение")
def __str__(self):
"""
String for representing the Model object (in Admin site etc.)
"""
return self.sensor.name
class Meta: # отображение в админики
verbose_name = "gказания датчика"
verbose_name_plural = "показания датчиков"
indexes = [
models.Index(fields=["sensor"]),
models.Index(fields=["sensor", "time"]),
]