Commit d78fad94 authored by Ross Batacan's avatar Ross Batacan

Updated rossbatacan_music/homepage/models.py with __str__ functions and...

Updated rossbatacan_music/homepage/models.py with __str__ functions and changed Song model attribute lyrics_video to lyrics.
parent 2cacb2fe
......@@ -3,21 +3,21 @@ from .models import Artist, Album, Song
class ArtistAdmin(admin.ModelAdmin):
model = Artist
list_display = ('artist_name', 'birth_name', 'monthly_listeners')
search_fields = ('artist_name', 'birth_name')
list_filter = ('artist_name', 'birth_name')
list_display = ('artist_name', 'birth_name', 'monthly_listeners',)
search_fields = ('artist_name', 'birth_name',)
list_filter = ('artist_name', 'birth_name',)
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_display = ('album_name', 'description', 'release_date', 'label', 'song_count',)
search_fields = ('album_name', 'description', 'label',)
list_filter = ('album_name',)
class SongAdmin(admin.ModelAdmin):
model = Song
list_display = ('song_title', 'song_length', 'music_video', 'lyrics_video')
search_fields = ('song_title', 'lyrics')
list_filter = ('song_title')
list_display = ('song_title', 'song_length', 'music_video', 'lyrics',)
search_fields = ('song_title', 'lyrics',)
list_filter = ('song_title',)
admin.site.register(Artist, ArtistAdmin)
admin.site.register(Album, AlbumAdmin)
......
......@@ -9,21 +9,32 @@ class Artist(models.Model):
birth_name = models.CharField(max_length=30, null=True)
bio = models.CharField(max_length=250, null=True)
def __str__(self):
return self.artist_name
class Album(models.Model):
album_name = models.CharField(max_length=20, unique=True, null=True)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE, null=True)
description = models.CharField(max_length=100, null=True)
description = models.CharField(max_length=250, null=True)
release_date = models.DateField(max_length=20, null=True)
label = models.CharField(max_length=100, null=True, blank=True)
song_count = models.IntegerField(null=True)
def __str__(self):
return self.album_name
class Song(models.Model):
song_title = models.CharField(max_length=50, null=True)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE, null=True)
album = models.ForeignKey(Album, on_delete=models.CASCADE, null=True)
song_length = models.IntegerField(null=True)
music_video = models.BooleanField(null=True)
lyrics_video = models.TextField(null=True)
lyrics = models.TextField(null=True)
def __str__(self):
return 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