1
0
Fork 0

Add VideoClip model

This commit is contained in:
Dece 2017-08-17 19:13:54 +02:00
parent b7d05c9fdf
commit 2f9956756e
3 changed files with 46 additions and 1 deletions

View file

@ -1,6 +1,6 @@
from django.contrib import admin
from label.models import Artist, Release
from label.models import Artist, Release, VideoClip
class ArtistAdmin(admin.ModelAdmin):
@ -9,3 +9,4 @@ class ArtistAdmin(admin.ModelAdmin):
admin.site.register(Artist, ArtistAdmin)
admin.site.register(Release)
admin.site.register(VideoClip)

View file

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-08-17 17:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('label', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='VideoClip',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=256)),
('year', models.IntegerField()),
('embed', models.TextField()),
('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='videos', to='label.Artist')),
],
options={
'ordering': ('year', 'title'),
},
),
]

View file

@ -64,3 +64,18 @@ class Release(models.Model):
class Meta(object):
ordering = ('ident', 'title')
class VideoClip(models.Model):
""" A video clip. """
title = models.CharField(max_length=256)
artist = models.ForeignKey(Artist, related_name='videos')
year = models.IntegerField()
embed = models.TextField()
def __str__(self):
return self.title
class Meta(object):
ordering = ('year', 'title')