42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
from django.db import models
|
||
import uuid
|
||
|
||
|
||
class SupplierProfile(models.Model):
|
||
"""Профиль поставщика на бирже - витринные данные для marketplace.
|
||
|
||
Первоисточник данных о поставщике - Team (team_type=SELLER).
|
||
Этот профиль содержит только витринную информацию для отображения на бирже.
|
||
"""
|
||
uuid = models.CharField(max_length=100, unique=True, default=uuid.uuid4)
|
||
team_uuid = models.CharField(max_length=100, unique=True) # Связь с Team
|
||
|
||
name = models.CharField(max_length=255)
|
||
description = models.TextField(blank=True, default='')
|
||
country = models.CharField(max_length=100, blank=True, default='')
|
||
country_code = models.CharField(max_length=3, blank=True, default='')
|
||
logo_url = models.URLField(blank=True, default='')
|
||
|
||
# Координаты для карты
|
||
latitude = models.FloatField(null=True, blank=True)
|
||
longitude = models.FloatField(null=True, blank=True)
|
||
|
||
is_verified = models.BooleanField(default=False)
|
||
is_active = models.BooleanField(default=True)
|
||
|
||
created_at = models.DateTimeField(auto_now_add=True)
|
||
updated_at = models.DateTimeField(auto_now=True)
|
||
|
||
class Meta:
|
||
db_table = 'suppliers' # Сохраняем имя таблицы для совместимости
|
||
ordering = ['name']
|
||
verbose_name = 'Supplier Profile'
|
||
verbose_name_plural = 'Supplier Profiles'
|
||
|
||
def __str__(self):
|
||
return f"{self.name} ({self.country})"
|
||
|
||
|
||
# Alias for backwards compatibility
|
||
Supplier = SupplierProfile
|