diff options
Diffstat (limited to 'app/media')
-rw-r--r-- | app/media/models.py | 9 |
1 files changed, 5 insertions, 4 deletions
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) |