Commit 0fe705a5 authored by John Riz Daniel Ramos's avatar John Riz Daniel Ramos

Updated the Admin Panel of homepage app

Changelogs to ArtistAdmin, AlbumAdmin, SongAdmin classes:
+ param: search_fields
+ param: list_filter
parent 90f674f6
from django.contrib import admin from django.contrib import admin
from .models import Artist, Album, Song from .models import Artist, Album, Song
class ArtistAdmin(admin.ModelAdmin): class ArtistAdmin(admin.ModelAdmin):
model = Artist model = Artist
list_display = ('artist_name', 'monthly_listeners') list_display = ('artist_name', 'birth_name', 'monthly_listeners')
search_fields = ('artist_name', 'birth_name')
list_filter = ('artist_name', 'birth_name')
class AlbumAdmin(admin.ModelAdmin): class AlbumAdmin(admin.ModelAdmin):
model = Album model = Album
list_display = ('album_name', 'artist', 'description', 'release_date') list_display = ('album_name', 'description', 'release_date', 'label', 'song_count')
search_fields = ('album_name', 'description', 'label')
list_filter = ('album_name')
class SongAdmin(admin.ModelAdmin): class SongAdmin(admin.ModelAdmin):
model = Song model = Song
list_display = ('song_title', 'artist', 'album', 'song_length') list_display = ('song_title', 'song_length', 'lyrics', 'music_video')
search_fields = ('song_title', 'lyrics')
list_filter = ('song_title')
admin.site.register(Artist, ArtistAdmin) admin.site.register(Artist, ArtistAdmin)
admin.site.register(Album, AlbumAdmin) admin.site.register(Album, AlbumAdmin)
......
...@@ -21,6 +21,6 @@ class Song(models.Model): ...@@ -21,6 +21,6 @@ class Song(models.Model):
song_title = models.CharField(max_length=50) song_title = models.CharField(max_length=50)
artist = models.CharField(max_length=50) artist = models.CharField(max_length=50)
album = models.CharField(max_length=150) album = models.CharField(max_length=150)
song_length = models.IntegerField() song_length = models.IntegerField(verbose_name="SONG LENGTH (in secs.)")
music_video = models.BooleanField(default=False) music_video = models.BooleanField(default=False)
lyrics = models.TextField(blank=True) lyrics = models.TextField(blank=True)
\ 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