Commit 00ec8770 authored by Alliyah Marcelo's avatar Alliyah Marcelo

Finished Lab ver.2.

parent 31d64f33
...@@ -17,12 +17,12 @@ class ArtistAdmin(admin.ModelAdmin): ...@@ -17,12 +17,12 @@ class ArtistAdmin(admin.ModelAdmin):
search_fields = ('artist_name', 'birth_name',) search_fields = ('artist_name', 'birth_name',)
list_filter = ('artist_name', 'birth_name',) list_filter = ('artist_name', 'birth_name',)
inlines = [AlbumInline, SongInline,] inlines = [AlbumInline,]
fieldsets = [ fieldsets = [
('Artist Data', { ('Artist Data', {
'fields':[ 'fields':[
('artist_name', 'birth_name'), 'monthly_listeners' ('artist_name', 'birth_name', 'bio'), 'monthly_listeners'
] ]
}), }),
] ]
...@@ -40,6 +40,8 @@ class AlbumAdmin(admin.ModelAdmin): ...@@ -40,6 +40,8 @@ class AlbumAdmin(admin.ModelAdmin):
search_fields = ('album_name', 'description', 'label',) search_fields = ('album_name', 'description', 'label',)
list_filter = ('album_name',) list_filter = ('album_name',)
inlines = [SongInline,]
class SongAdmin(admin.ModelAdmin): class SongAdmin(admin.ModelAdmin):
model = Song model = Song
......
# Generated by Django 3.2 on 2023-02-21 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0008_alter_song_music_video'),
]
operations = [
migrations.AlterField(
model_name='album',
name='song_count',
field=models.IntegerField(default='1'),
),
migrations.AlterField(
model_name='song',
name='song_length',
field=models.TimeField(),
),
]
# Generated by Django 3.2 on 2023-02-21 07:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0009_auto_20230221_1550'),
]
operations = [
migrations.AlterField(
model_name='song',
name='song_length',
field=models.DurationField(),
),
]
...@@ -12,12 +12,8 @@ class Artist(models.Model): ...@@ -12,12 +12,8 @@ class Artist(models.Model):
def __str__(self): def __str__(self):
return '{}: {}'.format(self.artist_name, self.birth_name) return '{}: {}'.format(self.artist_name, self.birth_name)
#def get_absolute_url(self): def get_absolute_url(self):
#return reverse(admin('artist_detail', args=[str(self.artist_name)])) return reverse('artist_detail', args=[str(self.artist_name)])
@property
def is_tutorial(self):
return self.monthly_listeners == 1
class Album(models.Model): class Album(models.Model):
...@@ -30,7 +26,7 @@ class Album(models.Model): ...@@ -30,7 +26,7 @@ class Album(models.Model):
description = models.CharField(max_length=1000) description = models.CharField(max_length=1000)
release_date = models.CharField(max_length=50) release_date = models.CharField(max_length=50)
label = models.CharField(max_length=50, blank=True) label = models.CharField(max_length=50, blank=True)
song_count = models.IntegerField(default='0000000') song_count = models.IntegerField(default='1')
def __str__(self): def __str__(self):
return '{}'.format(self.album_name) return '{}'.format(self.album_name)
...@@ -38,10 +34,6 @@ class Album(models.Model): ...@@ -38,10 +34,6 @@ class Album(models.Model):
#def get_absolute_url(self): #def get_absolute_url(self):
#return reverse(admin('artist_detail', args=[str(self.artist_name)])) #return reverse(admin('artist_detail', args=[str(self.artist_name)]))
@property
def is_tutorial(self):
return self.song_count == 1
class Song(models.Model): class Song(models.Model):
song_title = models.CharField(max_length=100) song_title = models.CharField(max_length=100)
...@@ -55,7 +47,7 @@ class Song(models.Model): ...@@ -55,7 +47,7 @@ class Song(models.Model):
on_delete=models.CASCADE, on_delete=models.CASCADE,
related_name='song_album' related_name='song_album'
) )
song_length = models.IntegerField() song_length = models.FloatField()
music_video = models.BooleanField(default=None) music_video = models.BooleanField(default=None)
lyrics = models.CharField(max_length=8000, blank=True) lyrics = models.CharField(max_length=8000, blank=True)
......
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