Commit f31c5086 authored by Brescia Amandy's avatar Brescia Amandy

Added list view customizations to homepage/admin.py

parent d34218f8
......@@ -4,12 +4,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')
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')
class SongAdmin(admin.ModelAdmin):
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(Album, AlbumAdmin)
......
# Generated by Django 3.0 on 2023-02-21 11:42
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=255),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(blank=True, default=1),
preserve_default=False,
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.TextField(blank=True, max_length=700),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.CharField(blank=True, max_length=255),
),
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=255),
),
migrations.AlterField(
model_name='album',
name='description',
field=models.TextField(blank=True, max_length=700),
),
migrations.AlterField(
model_name='album',
name='release_date',
field=models.CharField(blank=True, max_length=255),
),
migrations.AlterField(
model_name='artist',
name='artist_name',
field=models.CharField(blank=True, max_length=255),
),
migrations.AlterField(
model_name='artist',
name='monthly_listeners',
field=models.IntegerField(blank=True),
),
migrations.AlterField(
model_name='song',
name='song_length',
field=models.IntegerField(blank=True),
),
migrations.AlterField(
model_name='song',
name='song_title',
field=models.CharField(blank=True, max_length=255),
),
]
# Generated by Django 3.0 on 2023-02-21 11:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_auto_20230221_1942'),
]
operations = [
migrations.AlterField(
model_name='album',
name='song_count',
field=models.PositiveSmallIntegerField(default=1),
),
]
......@@ -14,7 +14,7 @@ class Album(models.Model):
description = models.TextField(blank=True, max_length=700)
release_date = models.CharField(blank=True, max_length=255)
label = models.CharField(blank=True, max_length=255)
song_count = models.IntegerField(blank=True)
song_count = models.PositiveSmallIntegerField(default=1)
class Song(models.Model):
......
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