Commit 2b41d757 authored by Washington99's avatar Washington99

Implemented the Customization in the Admin panel

Now has list display, filtering, and search functionalities
parent bc2ab480
...@@ -7,12 +7,30 @@ from .models import Artist, Album, Song ...@@ -7,12 +7,30 @@ from .models import Artist, Album, Song
class ArtistAdmin(admin.ModelAdmin): class ArtistAdmin(admin.ModelAdmin):
model = Artist model = Artist
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", "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", "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)
admin.site.register(Song, SongAdmin) admin.site.register(Song, SongAdmin)
# Generated by Django 3.2 on 2023-02-21 12:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_auto_20230221_1927'),
]
operations = [
migrations.AlterField(
model_name='song',
name='song_length',
field=models.CharField(max_length=10),
),
]
...@@ -20,6 +20,6 @@ class Song(models.Model): ...@@ -20,6 +20,6 @@ class Song(models.Model):
song_title = models.CharField(max_length = 50) song_title = models.CharField(max_length = 50)
artist = models.ForeignKey(Artist, on_delete = models.CASCADE) artist = models.ForeignKey(Artist, on_delete = models.CASCADE)
album = models.ForeignKey(Album, on_delete = models.CASCADE) album = models.ForeignKey(Album, on_delete = models.CASCADE)
song_length = models.IntegerField() song_length = models.CharField(max_length = 10)
music_video = models.BooleanField(default = False) music_video = models.BooleanField(default = False)
lyrics = models.TextField(max_length = 1000, blank = True) lyrics = models.TextField(max_length = 1000, 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