from django.db import models from tickets.models import Ticket from dbsynce.docs.database.service_category import ServiceCategory as HelpTexts from dbsynce.docs.verbose_names.service_category import ServiceCategory as VerboseName from core.settings_vars import METASERVICE_ID from dbsynce.lib import dicts class ServiceCategory(models.Model): """ Перечень типов услуг """ # ID METASERVICE id_metaservice = models.PositiveIntegerField( default=METASERVICE_ID, verbose_name = VerboseName.id_metaservice, help_text=HelpTexts.id_metaservice, ) # DATA codename = models.CharField( max_length=30, verbose_name = VerboseName.codename, help_text=HelpTexts.codename, ) requirements = models.CharField( max_length=50, #TODO fix default value! default="DSMPU", verbose_name = VerboseName.requirements, help_text=HelpTexts.requirements, ) status = models.CharField( max_length=1, default="1", choices = list(dicts.activity_status_by_code.items()), #choices = list(dicts.activity_status.items()), verbose_name = VerboseName.status, help_text=HelpTexts.status, ) caption = models.CharField( max_length=255, verbose_name = VerboseName.caption, help_text=HelpTexts.caption, ) description = models.TextField( blank=True, verbose_name = VerboseName.description, help_text=HelpTexts.description, ) link_agreement = models.CharField( max_length=400, verbose_name = VerboseName.link_agreement, help_text=HelpTexts.link_agreement, ) price_type = models.CharField( max_length=1, choices = list(dicts.price_type_by_code.items()), verbose_name = VerboseName.price_type, help_text=HelpTexts.price_type, ) metaservice_comission = models.FloatField( verbose_name = VerboseName.metaservice_comission, help_text=HelpTexts.metaservice_comission, ) # OTHER is_global = models.CharField( max_length=1, default="f", choices = list(dicts.is_global_by_code.items()), verbose_name = VerboseName.is_global, help_text=HelpTexts.is_global, ) is_visible = models.CharField( max_length=1, default="f", choices = list(dicts.is_visible_by_code.items()), verbose_name = VerboseName.is_visible, help_text=HelpTexts.is_visible, ) # FK ticket_status = models.ForeignKey( Ticket, on_delete=models.DO_NOTHING, null=True, verbose_name = VerboseName.ticket_status, help_text=HelpTexts.ticket_status, ) class Meta: db_table = "service_category" verbose_name = "Тип услуги" verbose_name_plural = "Типы услуг"