Modified admin list view

parent b3dc6b39
No preview for this file type
...@@ -12,9 +12,17 @@ class ArtistAdmin(admin.ModelAdmin): ...@@ -12,9 +12,17 @@ class ArtistAdmin(admin.ModelAdmin):
class AlbumAdmin(admin.ModelAdmin): class AlbumAdmin(admin.ModelAdmin):
model = Album model = Album
search_fields = ('album_name', 'artist',)
list_display = ('album_name', 'artist',)
list_filter = ('album_name', 'artist',)
class SongAdmin(admin.ModelAdmin): class SongAdmin(admin.ModelAdmin):
model = Song model = Song
search_fields = ('album', 'artist', 'song_title',)
list_display = ('album', 'artist', 'song_title',)
list_filter = ('album', 'artist', '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)
\ No newline at end of file
# Generated by Django 4.1.7 on 2023-02-21 14:34
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=200, null=True),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.TextField(blank=True, max_length=700, null=True),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='song',
name='lyrics',
field=models.TextField(blank=True, null=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=50, null=True),
),
migrations.AlterField(
model_name='album',
name='artist',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AlterField(
model_name='album',
name='description',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='album',
name='release_date',
field=models.CharField(blank=True, max_length=20, null=True),
),
migrations.AlterField(
model_name='artist',
name='artist_name',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AlterField(
model_name='artist',
name='monthly_listeners',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AlterField(
model_name='song',
name='song_length',
field=models.IntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='song',
name='song_title',
field=models.CharField(blank=True, max_length=50, null=True),
),
]
from django.db import models from django.db import models
class Artist(models.Model): class Artist(models.Model):
artist_name = models.CharField(max_length=50) artist_name = models.CharField(max_length=50, blank=True, null=True)
monthly_listeners = models.IntegerField() monthly_listeners = models.IntegerField(blank=True, null=True)
birth_name = models.TextField() birth_name = models.TextField(blank=True, null=True)
bio = models.TextField(max_length=700) bio = models.TextField(max_length=700, blank=True, null=True)
class Album(models.Model): class Album(models.Model):
album_name = models.CharField(max_length=50) album_name = models.CharField(max_length=50, blank=True, null=True)
artist = models.CharField(max_length=50) artist = models.CharField(max_length=50, blank=True, null=True)
description = models.TextField() description = models.TextField(blank=True, null=True)
release_date = models.CharField(max_length=20) release_date = models.CharField(max_length=20, blank=True, null=True)
label = models.CharField(max_length=50) label = models.CharField(max_length=200, blank=True, null=True)
song_count = models.IntegerField() song_count = models.IntegerField(blank=True, null=True)
class Song(models.Model): class Song(models.Model):
song_title = models.CharField(max_length=50) song_title = models.CharField(max_length=50, blank=True, null=True)
artist = models.CharField(max_length=50) artist = models.CharField(max_length=50, blank=True, null=True)
album = models.CharField(max_length=50) album = models.CharField(max_length=50, blank=True, null=True)
song_length = models.IntegerField() song_length = models.IntegerField(blank=True, null=True)
music_video = models.BooleanField(default=False) music_video = models.BooleanField(default=False)
lyrics = models.TextField() lyrics = models.TextField(blank=True, null=True)
\ No newline at end of file \ 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