Commit 88eb8d8b authored by Almira Redoble's avatar Almira Redoble

Merge branch 'lab02'

parents b3452f41 bc1bf221
Almira Princess Redoble, 214897, 2 BS CS-DGDD; Almira Princess Redoble, 214897, 2 BS CS-DGDD;
Lab 01: Song Library; Lab 02: Song Library v2;
February 13, 2023; February 20, 2023;
I hereby certify that this lab activity was truthfully completed by me, Almira Redoble; I hereby certify that this lab activity was truthfully completed by me, Almira Redoble;
Information on the albums, songs, and artists were copied from Spotify and Wikipedia; Information on the albums, songs, and artists were copied from Spotify and Wikipedia;
<sgd> Almira Princess Redoble, February 13, 2023 <sgd> Almira Princess Redoble, February 13, 2023
from django.contrib import admin from django.contrib import admin
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)
admin.site.register(Song, SongAdmin)
# Register your models here. # Register your models here.
# Generated by Django 3.2 on 2023-02-20 09:37
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(default='', max_length=50),
),
migrations.AddField(
model_name='album',
name='song_count',
field=models.IntegerField(default=1),
),
migrations.AddField(
model_name='artist',
name='bio',
field=models.CharField(default='', max_length=700),
),
migrations.AddField(
model_name='artist',
name='birth_name',
field=models.CharField(default='', max_length=50),
),
migrations.AddField(
model_name='song',
name='lyrics',
field=models.CharField(default='', max_length=300),
),
migrations.AddField(
model_name='song',
name='music_video',
field=models.BooleanField(default=False),
),
]
...@@ -3,6 +3,8 @@ from django.db import models ...@@ -3,6 +3,8 @@ 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)
monthly_listeners = models.IntegerField() monthly_listeners = models.IntegerField()
birth_name = models.CharField(max_length=50, default="")
bio = models.CharField(max_length=700, default="")
def __str__(self): def __str__(self):
return '{}: {} monthly listener(s)'.format( return '{}: {} monthly listener(s)'.format(
...@@ -20,6 +22,8 @@ class Album(models.Model): ...@@ -20,6 +22,8 @@ class Album(models.Model):
) )
description = models.CharField(max_length=100) description = models.CharField(max_length=100)
release_date = models.DateField() release_date = models.DateField()
label = models.CharField(max_length=50, default="")
song_count = models.IntegerField(default=1)
def __str__(self): def __str__(self):
return '{} by {}: \n {} \n released on {}'.format( return '{} by {}: \n {} \n released on {}'.format(
...@@ -43,6 +47,8 @@ class Song(models.Model): ...@@ -43,6 +47,8 @@ class Song(models.Model):
related_name='song' related_name='song'
) )
song_length = models.IntegerField() song_length = models.IntegerField()
music_video = models.BooleanField(default=False)
lyrics = models.CharField(max_length=300, default="")
def __str__(self): def __str__(self):
return '{} by {} in {}'.format( return '{} by {} in {}'.format(
...@@ -52,5 +58,5 @@ class Song(models.Model): ...@@ -52,5 +58,5 @@ class Song(models.Model):
) )
# DateField source: https://www.geeksforgeeks.org/datefield-django-models/ # DateField source: https://www.geeksforgeeks.org/datefield-django-models/
# BooleanField source: https://www.geeksforgeeks.org/booleanfield-django-models/
# Create your models here. # Create your models here.
commit dda526b6e7ac5d3869849a0337f96f10dc650a72 (HEAD -> main, origin/main)
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 20:57:05 2023 +0800
Migrated models Album, Artist, Song
commit 6a1ab2618a46c76a1a257f15a564b13b4937c5bb
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 20:39:08 2023 +0800
Created Artist, Album, Song Models in homepage app
commit 4529da673002565f5f5ca76b6f5657cbdd95e4eb
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 20:00:02 2023 +0800
Implemented site-wide URL configuration
commit 5d14fb623c6205877fcdd239d03a1f94aaf78fb3
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:56:13 2023 +0800
Added urls.py and created view for homepage app
commit 6dd091fa9cc71e3263d8dfe54685bf1b21803876
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:55:05 2023 +0800
Added urls.py and created view for contact app
commit 2d0706339a2d36ae544d8392d21595968730ce9a
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:53:50 2023 +0800
Added urls.py and created view for about app
commit b33a9d8d8c2591c7373d3d0b310d8779c5129145
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:49:58 2023 +0800
Added Django App contact
commit 07ca5f029be5ed9d32da306fbb445329c9914379
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:48:42 2023 +0800
Added Django App about
commit 52e17d258c39f533017cbc995aa40bf076ee346d
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:48:09 2023 +0800
Added Django App homepage
commit edf104a7438c45ee4d16cf0ec83a51c0a9283114
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:45:58 2023 +0800
Added Django Project almiraredoble_music
commit b685c1445e6787daf342b2b2d7ea28fcc9b01cff
Author: Almira Redoble <almira.redoble@obf.ateneo.edu>
Date: Mon Feb 13 19:45:28 2023 +0800
Added README.txt
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