From ecf5763d392d63b7efe1fd4f906e11281f5438a2 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 7 May 2023 14:17:05 -0400 Subject: media: fixed upload bug even though it doesn't work --- app/media/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/media') diff --git a/app/media/models.py b/app/media/models.py index c93b9fc..64f427a 100644 --- a/app/media/models.py +++ b/app/media/models.py @@ -5,6 +5,7 @@ from pathlib import Path from PIL import Image from django.core.exceptions import ValidationError +from django.core.files import File from django.contrib.gis.db import models from django.contrib.sitemaps import Sitemap from django.db.models.signals import post_save @@ -26,17 +27,17 @@ from .utils import resize_image from locations.models import Location, CheckIn -def add_mp4(self, filepath, luxvideo): +def add_mp4(filepath, luxvideo): full_filepath = "/home/lxf/sites/django/luxagraf.net/"+filepath - v = open(filepath, "rb") + v = open(full_filepath, "rb") django_file = File(v) video = LuxVideo.objects.get(title=luxvideo) video.video_mp4.save(filepath, django_file, save=True) -def add_webm(self, filepath, luxvideo): +def add_webm(filepath, luxvideo): full_filepath = "/home/lxf/sites/django/luxagraf.net/"+filepath - v = open(filepath, "rb") + v = open(full_filepath, "rb") django_file = File(v) video = LuxVideo.objects.get(title=luxvideo) video.video_webm.save(filepath, django_file, save=True) -- cgit v1.2.3-70-g09d2