Add VideoClip model
This commit is contained in:
parent
b7d05c9fdf
commit
2f9956756e
|
@ -1,6 +1,6 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from label.models import Artist, Release
|
from label.models import Artist, Release, VideoClip
|
||||||
|
|
||||||
|
|
||||||
class ArtistAdmin(admin.ModelAdmin):
|
class ArtistAdmin(admin.ModelAdmin):
|
||||||
|
@ -9,3 +9,4 @@ class ArtistAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
admin.site.register(Artist, ArtistAdmin)
|
admin.site.register(Artist, ArtistAdmin)
|
||||||
admin.site.register(Release)
|
admin.site.register(Release)
|
||||||
|
admin.site.register(VideoClip)
|
||||||
|
|
29
label/migrations/0002_videoclip.py
Normal file
29
label/migrations/0002_videoclip.py
Normal 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'),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -64,3 +64,18 @@ class Release(models.Model):
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
ordering = ('ident', 'title')
|
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')
|
||||||
|
|
Loading…
Reference in a new issue