from django.db import models
from .validators import videoValidate, imageValidate
from django.contrib.auth.models import User

# def user_directory._path(instance, filename):
      # print(request.user.id)
      # return 'user_{0}/{1}'.format(instance.user.id, filename)
# Ok i got hella angry, so pleaSE fix this bullshit
# I want to be able to store each and every user's files in a separate folder, based on their id
# I CANT GET A FUCKING LOGGED IN USER ID FROM THE MODELS THINGY IM FUCKING PISSED

class Image(models.Model):
    title = models.CharField(max_length=200)
    image = models.ImageField(upload_to=f"images/",validators=[imageValidate])
    user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True)

    def __str__(self):
        return self.title

class Videos(models.Model):
    title = models.CharField(max_length=100)
    video = models.FileField(upload_to=f'videos/', validators=[videoValidate])

    class Meta:
        verbose_name = 'video'
        verbose_name_plural = 'videos'

    def __str__(self):
        return self.title
