Commit 572d8e20 authored by EJ Mejilla's avatar EJ Mejilla

Fixed admin panel and models to include defaults

Made migrations
parent c43ad140
......@@ -13,14 +13,14 @@ class AlbumAdmin(admin.ModelAdmin):
model = Album
list_display = ('album_name', 'description', 'release_date', 'label', 'song_count')
search_fields = ('album_name', 'description', 'label')
list_filter = ('album_name')
list_filter = ('album_name',)
class SongAdmin(admin.ModelAdmin):
model = Song
list_display = ('song_title', 'song_length', 'lyrics', 'music_video')
search_fields = ('song_title', 'lyrics')
list_filter = ('song_title')
list_filter = ('song_title',)
admin.site.register(Artist, ArtistAdmin)
......
# Generated by Django 3.2 on 2023-02-20 14:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='album',
name='label',
field=models.CharField(blank=True, max_length=100),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.CharField(blank=True, max_length=700),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.CharField(blank=True, max_length=100),
),
migrations.AddField(
model_name='song',
name='lyrics',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='song',
name='music_video',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='album',
name='album_name',
field=models.CharField(blank=True, max_length=100),
),
migrations.AlterField(
model_name='artist',
name='artist_name',
field=models.CharField(blank=True, max_length=100),
),
migrations.AlterField(
model_name='song',
name='song_title',
field=models.CharField(blank=True, max_length=100),
),
]
......@@ -4,10 +4,10 @@ from django.urls import reverse
class Artist(models.Model):
artist_name = models.CharField(max_length=100, unique=True)
artist_name = models.CharField(max_length=100, blank=True)
monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=100, unique=True)
bio = models.CharField(max_length=700)
birth_name = models.CharField(max_length=100, blank=True)
bio = models.CharField(max_length=700, blank=True)
def __str__(self):
return self.artist_name
......@@ -17,12 +17,12 @@ class Artist(models.Model):
class Album(models.Model):
album_name = models.CharField(max_length=100, unique=True)
album_name = models.CharField(max_length=100, blank=True)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
description = models.CharField(max_length=500)
release_date = models.DateField()
label = models.CharField(max_length=100, unique=True)
song_count = models.IntegerField()
label = models.CharField(max_length=100, blank=True)
song_count = models.IntegerField(default=0)
def __str__(self):
return f"{self.artist}'s {self.album_name}"
......@@ -32,12 +32,12 @@ class Album(models.Model):
class Song(models.Model):
song_title = models.CharField(max_length=100, unique=True)
song_title = models.CharField(max_length=100, blank=True)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
album = models.ForeignKey(Album, on_delete=models.CASCADE)
song_length = models.IntegerField()
music_video = models.BooleanField()
lyrics = models.CharField()
music_video = models.BooleanField(default=False)
lyrics = models.TextField(blank=True)
def __str__(self):
return f"{self.artist} - {self.song_title}"
......
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