from django.db import models

from django.contrib.auth.models import User

from products.models import Product


class Sale(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, on_delete=models.CASCADE)

    class Meta:
        verbose_name = "Venta"
        verbose_name_plural = "Ventas"

    def __str__(self):
        return "{0}: {1}".format(self.user.first_name, self.product.name)
