Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
albomediano_music
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Al Vincent E. Bomediano
albomediano_music
Commits
440a68b5
Commit
440a68b5
authored
Feb 21, 2023
by
Al Vincent E. Bomediano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update admin view on models
parent
653e3176
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
16 deletions
+61
-16
settings.cpython-311.pyc
...ic/albomediano_music/__pycache__/settings.cpython-311.pyc
+0
-0
db.sqlite3
albomediano_music/db.sqlite3
+0
-0
admin.cpython-311.pyc
albomediano_music/homepage/__pycache__/admin.cpython-311.pyc
+0
-0
models.cpython-311.pyc
...mediano_music/homepage/__pycache__/models.cpython-311.pyc
+0
-0
admin.py
albomediano_music/homepage/admin.py
+34
-16
0002_alter_song_lyrics.py
...diano_music/homepage/migrations/0002_alter_song_lyrics.py
+18
-0
0002_alter_song_lyrics.cpython-311.pyc
...ations/__pycache__/0002_alter_song_lyrics.cpython-311.pyc
+0
-0
models.py
albomediano_music/homepage/models.py
+9
-0
No files found.
albomediano_music/albomediano_music/__pycache__/settings.cpython-311.pyc
View file @
440a68b5
No preview for this file type
albomediano_music/db.sqlite3
View file @
440a68b5
No preview for this file type
albomediano_music/homepage/__pycache__/admin.cpython-311.pyc
View file @
440a68b5
No preview for this file type
albomediano_music/homepage/__pycache__/models.cpython-311.pyc
View file @
440a68b5
No preview for this file type
albomediano_music/homepage/admin.py
View file @
440a68b5
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
Artist
,
Album
,
Song
from
.models
import
Artist
,
Album
,
Song
class
A
rtistAdmin
(
admin
.
ModelAdmin
):
class
A
lbumInline
(
admin
.
TabularInline
):
model
=
A
rtist
model
=
A
lbum
list_display
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
)
search_fields
=
(
'artist_name'
,
'birth_name'
)
class
SongInline
(
admin
.
TabularInline
):
model
=
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'
)
list_filter
=
(
'artist_name'
,
'birth_name'
)
inlines
=
[
AlbumInline
,
SongInline
,
]
fieldsets
=
[
(
'Artist Data'
,
{
'fields'
:
[
(
'artist_name'
,
'birth_name'
),
'monthly_listeners'
,
'bio'
]
}),
]
class
AlbumAdmin
(
admin
.
ModelAdmin
):
class
AlbumAdmin
(
admin
.
ModelAdmin
):
model
=
Album
model
=
Album
list_display
=
(
list_display
=
(
'album_name'
,
'description'
,
'release_date'
,
'label'
,
'song_count'
)
'album_name'
,
'description'
,
'release_date'
,
'label'
,
'song_count'
)
search_fields
=
(
'album_name'
,
'description'
,
'label'
)
search_fields
=
(
'album_name'
,
'description'
,
'label'
)
list_filter
=
(
'album_name'
,)
list_filter
=
(
'album_name'
,
)
class
SongAdmin
(
admin
.
ModelAdmin
):
class
SongAdmin
(
admin
.
ModelAdmin
):
model
=
Song
model
=
Song
list_display
=
(
'song_title'
,
list_display
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
)
'song_length'
,
'lyrics'
,
'music_video'
)
search_fields
=
(
'song_title'
,
'lyrics'
)
search_fields
=
(
'song_title'
,
'lyrics'
)
list_filter
=
(
'song_title'
,)
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
)
\ No newline at end of file
albomediano_music/homepage/migrations/0002_alter_song_lyrics.py
0 → 100644
View file @
440a68b5
# Generated by Django 4.1.7 on 2023-02-21 13:58
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'song'
,
name
=
'lyrics'
,
field
=
models
.
CharField
(
max_length
=
8000
),
),
]
albomediano_music/homepage/migrations/__pycache__/0002_alter_song_lyrics.cpython-311.pyc
0 → 100644
View file @
440a68b5
File added
albomediano_music/homepage/models.py
View file @
440a68b5
...
@@ -7,6 +7,9 @@ class Artist(models.Model):
...
@@ -7,6 +7,9 @@ class Artist(models.Model):
bio
=
models
.
CharField
(
max_length
=
700
)
bio
=
models
.
CharField
(
max_length
=
700
)
monthly_listeners
=
models
.
IntegerField
()
monthly_listeners
=
models
.
IntegerField
()
def
str
(
self
):
return
'{} aka {}'
.
format
(
self
.
artist_name
,
self
.
birth_name
)
class
Album
(
models
.
Model
):
class
Album
(
models
.
Model
):
album_name
=
models
.
CharField
(
max_length
=
100
)
album_name
=
models
.
CharField
(
max_length
=
100
)
...
@@ -16,6 +19,9 @@ class Album(models.Model):
...
@@ -16,6 +19,9 @@ class Album(models.Model):
release_date
=
models
.
CharField
(
max_length
=
10
)
release_date
=
models
.
CharField
(
max_length
=
10
)
song_count
=
models
.
IntegerField
()
song_count
=
models
.
IntegerField
()
def
str
(
self
):
return
'{} aka {}'
.
format
(
self
.
album_name
,
self
.
label
)
class
Song
(
models
.
Model
):
class
Song
(
models
.
Model
):
song_title
=
models
.
CharField
(
max_length
=
100
)
song_title
=
models
.
CharField
(
max_length
=
100
)
...
@@ -24,3 +30,6 @@ class Song(models.Model):
...
@@ -24,3 +30,6 @@ class Song(models.Model):
song_length
=
models
.
IntegerField
()
song_length
=
models
.
IntegerField
()
music_video
=
models
.
BooleanField
()
music_video
=
models
.
BooleanField
()
lyrics
=
models
.
CharField
(
max_length
=
8000
)
lyrics
=
models
.
CharField
(
max_length
=
8000
)
def
str
(
self
):
return
'{}'
.
format
(
self
.
song_title
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment