Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jak_hermosisima_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
Joaquin Hermosisima
jak_hermosisima_music
Commits
35f4fa1d
Commit
35f4fa1d
authored
Feb 23, 2023
by
Joaquin Hermosisima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
admin.py is fully set up
parent
afbf660e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletion
+42
-1
db.sqlite3
jak_hermosisima_music/db.sqlite3
+0
-0
admin.py
jak_hermosisima_music/homepage/admin.py
+42
-0
models.py
jak_hermosisima_music/homepage/models.py
+0
-1
No files found.
jak_hermosisima_music/db.sqlite3
View file @
35f4fa1d
No preview for this file type
jak_hermosisima_music/homepage/admin.py
View file @
35f4fa1d
from
django.contrib
import
admin
from
.models
import
Artist
,
Album
,
Song
# Register your models here.
class
ArtistAdmin
(
admin
.
ModelAdmin
):
def
__str__
(
self
)
->
str
:
return
Artist
.
artist_name
model
=
Artist
fields
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
,
'bio'
,)
list_display
=
(
'artist_name'
,
'birth_name'
,
'monthly_listeners'
)
search_fields
=
(
'artist_name'
,
'birth_name'
)
list_filter
=
(
'artist_name'
,
'birth_name'
)
class
AlbumAdmin
(
admin
.
ModelAdmin
):
def
__str__
(
self
)
->
str
:
return
Album
.
album_name
model
=
Album
fields
=
(
'album_name'
,
'artist'
,
'description'
,
'release_date'
,
'label'
,
'song_count'
)
list_display
=
(
'album_name'
,
'description'
,
'release_date'
,
'label'
,
'song_count'
)
search_fields
=
(
'album_name'
,
'description'
,
'label'
,)
list_filter
=
(
'album_name'
,)
class
SongAdmin
(
admin
.
ModelAdmin
):
def
__str__
(
self
)
->
str
:
return
Song
.
song_title
model
=
Song
list_display
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
)
fields
=
(
'song_title'
,
'song_length'
,
'lyrics'
,
'music_video'
,
'artist'
,
'album'
)
search_fields
=
(
'song_title'
,
'lyrics'
)
list_filter
=
(
'song_title'
,)
admin
.
site
.
register
(
Artist
,
ArtistAdmin
)
admin
.
site
.
register
(
Album
,
AlbumAdmin
)
admin
.
site
.
register
(
Song
,
SongAdmin
)
\ No newline at end of file
jak_hermosisima_music/homepage/models.py
View file @
35f4fa1d
...
...
@@ -16,7 +16,6 @@ class Album(models.Model):
release_date
=
models
.
DateField
()
song_count
=
models
.
IntegerField
(
default
=
0
)
class
Song
(
models
.
Model
):
song_title
=
models
.
CharField
(
max_length
=
50
,
default
=
""
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
...
...
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