Commit 97d0b332 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Add serializer for videofile

parent 16e1e916
from rest_framework import serializers
from .models import Video
from .models import Video, VideoFile
class VideoFileSerializer(serializers.ModelSerializer):
class Meta:
model = VideoFile
fields = ('id', 'name', 'video', 'file')
class VideoSerializer(serializers.ModelSerializer):
class Meta:
model = Video
fields = ('id', 'name', 'youtube_id',)
fields = ('id', 'name', 'youtube_id', 'file')
file = VideoFileSerializer(required=False)
from django.shortcuts import render
# Create your views here.
from rest_framework import viewsets
from courses.videos.models import VideoFile
from courses.videos.serializers import VideoFileSerializer
from courses.permissions import (
IsProfessorCoordinatorOrAdminPermissionOrReadOnly,
)
class VideoFileViewSet(viewsets.ModelViewSet):
model = VideoFile
queryset = VideoFile.objects.all()
serializer_class = VideoFileSerializer
permission_classes = (IsProfessorCoordinatorOrAdminPermissionOrReadOnly,)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment