Commit 8aab095f authored by Kirsten Daena Chidrome's avatar Kirsten Daena Chidrome

merged admin, models, migrations

parents 6b21376b 41dc861b
Kirsten Daena C. Chidrome
211445
CSCI 40-C
Lab 01: Song Library
February 13,2022
Lab 02: Song Library v2
February 20,2022
I, Kirsten Chidrome, started and completed this project.
Signed Kirsten Daena C. Chidrome, February 13, 2022
\ No newline at end of file
Signed Kirsten Daena C. Chidrome, February 20, 2022
\ No newline at end of file
from django.contrib import admin
from .models import Artist, Album, Song
# Register your models here.
class ArtistAdmin(admin.ModelAdmin):
list_display = ("artist_name", "monthly_listeners", "birth_name")
search_field = ("artist_name", "birth_name")
list_filter = ("artist_name", "birth_name")
class AlbumAdmin(admin.ModelAdmin):
list_display = ("album_name", "description", "release_date", "label", "song_count")
search_field = ("album_name", "description", "label")
list_filter = ("lbum_name")
class SongAdmin(admin.ModelAdmin):
list_display = ("song_title", "song_length","lyrics", "music_video" )
search_field = ("song_title", "lyrics")
list_filter = ("song_title")
admin.site.register(Artist)
admin.site.register(Album)
admin.site.register(Song)
# Generated by Django 3.2 on 2023-02-13 07:51
# Generated by Django 3.2 on 2023-02-20 05:34
from django.db import migrations, models
import django.db.models.deletion
......@@ -17,8 +17,10 @@ class Migration(migrations.Migration):
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('album_name', models.CharField(max_length=50)),
('description', models.CharField(max_length=100)),
('description', models.CharField(max_length=200)),
('release_date', models.DateTimeField(verbose_name='date released')),
('label', models.CharField(max_length=50)),
('song_count', models.IntegerField(default=0)),
],
),
migrations.CreateModel(
......@@ -27,6 +29,8 @@ class Migration(migrations.Migration):
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('artist_name', models.CharField(max_length=50)),
('monthly_listeners', models.IntegerField(default=0)),
('birth_name', models.CharField(max_length=50)),
('bio', models.CharField(max_length=700)),
],
),
migrations.CreateModel(
......@@ -35,6 +39,8 @@ class Migration(migrations.Migration):
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('song_title', models.CharField(max_length=50)),
('song_length', models.IntegerField(default=0)),
('music_video', models.BooleanField(default=False)),
('lyrics', models.CharField(max_length=3000)),
('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.album')),
('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.artist')),
],
......
# Generated by Django 3.2 on 2023-02-21 05:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='song',
name='lyrics',
field=models.TextField(),
),
]
# Generated by Django 3.2 on 2023-02-21 11:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_alter_song_lyrics'),
]
operations = [
migrations.AlterField(
model_name='album',
name='album_name',
field=models.TextField(),
),
migrations.AlterField(
model_name='album',
name='description',
field=models.TextField(),
),
migrations.AlterField(
model_name='album',
name='label',
field=models.TextField(),
),
migrations.AlterField(
model_name='artist',
name='bio',
field=models.TextField(),
),
]
......@@ -2,17 +2,33 @@ from django.db import models
# Create your models here.
class Artist(models.Model):
artist_name = models.CharField(max_length = 50)
monthly_listeners = models.IntegerField(default = 0)
artist_name = models.CharField(max_length=50)
monthly_listeners = models.IntegerField(default=0)
birth_name = models.CharField(max_length=50)
bio = models.TextField()
def __str__(self):
return self.artist_name
class Album(models.Model):
album_name = models.CharField(max_length = 50)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
description = models.CharField(max_length = 100)
album_name = models.TextField()
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.TextField()
release_date = models.DateTimeField("date released")
label = models.TextField()
song_count = models.IntegerField(default=0)
def __str__(self):
return self.album_name
class Song(models.Model):
song_title = models.CharField(max_length = 50)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
album = models.ForeignKey(Album, on_delete = models.CASCADE)
song_length = models.IntegerField(default = 0)
\ No newline at end of file
song_title = models.CharField(max_length=50)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField(default=0)
music_video = models.BooleanField(default=False)
lyrics = models.TextField()
def __str__(self):
return self.song_title
\ No newline at end of file
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