This commit is contained in:
Trey t
2023-07-14 14:55:15 -05:00
parent 4e1c4777ad
commit c5b577fc1b
14 changed files with 107 additions and 2 deletions

0
video/__init__.py Normal file
View File

7
video/admin.py Normal file
View File

@@ -0,0 +1,7 @@
from django.contrib import admin
from .models import Video
# Register your models here.
@admin.register(Video)
class VideoAdmin(admin.ModelAdmin):
list_display = ("video_file",)

6
video/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class VideoConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'video'

View File

@@ -0,0 +1,23 @@
# Generated by Django 4.2.2 on 2023-07-14 19:24
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Video',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('video_file', models.FileField(null=True, upload_to='videos/', verbose_name='')),
],
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 4.2.2 on 2023-07-14 19:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('video', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='video',
name='gender',
field=models.PositiveSmallIntegerField(choices=[(1, 'male'), (2, 'female'), (3, 'both')], default=1),
preserve_default=False,
),
]

View File

19
video/models.py Normal file
View File

@@ -0,0 +1,19 @@
from django.db import models
# Create your models here.
VIDEO_GENDER = (
(1, "male"),
(2, "female"),
(3, "both"),
)
class Video(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
video_file = models.FileField(upload_to='videos/', null=True, verbose_name="")
gender = models.PositiveSmallIntegerField(
choices=VIDEO_GENDER
)
def __str__(self):
return str(self.video_file)

7
video/serializers.py Normal file
View File

@@ -0,0 +1,7 @@
from rest_framework import serializers
from .models import *
class VideoSerializer(serializers.ModelSerializer):
class Meta:
model = Video
fields = ('video_file',)

3
video/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
video/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.