from django.contrib.auth.models import AbstractUser
from django.db import models


class CustomUser(AbstractUser):
    photo = models.ImageField(verbose_name="Аватар", blank=False, upload_to='users/')


class Product(models.Model):
    name = models.CharField(verbose_name="Название товара", max_length=50)
    desc = models.CharField(verbose_name="Описание товара", max_length=200)
    photo = models.ImageField(verbose_name="Фото", blank=False, upload_to='products/')
    date_creation = models.DateTimeField(verbose_name="Дата создания товара", auto_now_add=True)


class Order(models.Model):
    user = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
