Files
exchange/suppliers/models.py
2026-01-07 09:12:35 +07:00

42 lines
1.6 KiB
Python
Raw Permalink 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.

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