Pretty nice commit overall, made the upload mechanic much more realistic and usable. Only thing left for the upload is the user id assignment. Check new ideas in discord.
This commit is contained in:
@ -1,4 +1,27 @@
|
||||
from django.db import models
|
||||
from .validators import videoValidate, imageValidate
|
||||
|
||||
# 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):
|
||||
image = models.FileField(upload_to='static/')
|
||||
title = models.CharField(max_length=200)
|
||||
image = models.ImageField(upload_to=f"images/{upload_to}",validators=[imageValidate])
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user