feat: Video Site App - 3. Create model and do migrations
parent
f19c0cb457
commit
3df57e2256
@ -1,3 +1,4 @@
|
||||
from django.contrib import admin
|
||||
from .models import Video
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Video)
|
||||
|
@ -0,0 +1,24 @@
|
||||
# Generated by Django 2.2.2 on 2019-06-28 00:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Video',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=64)),
|
||||
('date', models.DateTimeField(auto_now_add=True)),
|
||||
('video_file', models.FileField(upload_to='')),
|
||||
('thumb_file', models.FileField(upload_to='')),
|
||||
],
|
||||
),
|
||||
]
|
@ -1,3 +1,11 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Video(models.Model):
|
||||
title = models.CharField(max_length=64)
|
||||
date = models.DateTimeField(auto_now_add=True)
|
||||
video_file = models.FileField(upload_to='uploads/video')
|
||||
thumb_file = models.FileField(upload_to='uploads/image')
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.id} - {self.title}'
|
||||
|
Loading…
Reference in New Issue