Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
layvillanueva_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
Layla Mikel Villanueva
layvillanueva_music
Commits
02335701
Commit
02335701
authored
Feb 13, 2023
by
Lay Villanueva
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added function in models.py
added get_absolute_url per class
parent
d4e0f84b
Pipeline
#2740
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
models.py
layvillanueva_music/homepage/models.py
+9
-0
No files found.
layvillanueva_music/homepage/models.py
View file @
02335701
...
@@ -8,6 +8,9 @@ class Artist(models.Model):
...
@@ -8,6 +8,9 @@ class Artist(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} - {} monthly listeners'
.
format
(
self
.
artist_name
,
self
.
monthly_listeners
)
return
'{} - {} monthly listeners'
.
format
(
self
.
artist_name
,
self
.
monthly_listeners
)
def
get_absolute_url
(
self
):
return
reverse
(
'artist_detail'
,
args
=
[
str
(
self
.
artist_name
)])
class
Album
(
models
.
Model
):
class
Album
(
models
.
Model
):
album_name
=
models
.
CharField
(
max_length
=
255
)
album_name
=
models
.
CharField
(
max_length
=
255
)
...
@@ -18,6 +21,9 @@ class Album(models.Model):
...
@@ -18,6 +21,9 @@ class Album(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} by {} released on {} is {}'
.
format
(
self
.
album_name
,
self
.
artist
,
return
'{} by {} released on {} is {}'
.
format
(
self
.
album_name
,
self
.
artist
,
self
.
release_date
,
self
.
description
)
self
.
release_date
,
self
.
description
)
def
get_absolute_url
(
self
):
return
reverse
(
'album_detail'
,
args
=
[
str
(
self
.
album_name
)])
class
Song
(
models
.
Model
):
class
Song
(
models
.
Model
):
song_title
=
models
.
CharField
(
max_length
=
255
)
song_title
=
models
.
CharField
(
max_length
=
255
)
...
@@ -28,3 +34,6 @@ class Song(models.Model):
...
@@ -28,3 +34,6 @@ class Song(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} by {} from {} is {} long.'
.
format
(
self
.
song_title
,
self
.
artist
,
return
'{} by {} from {} is {} long.'
.
format
(
self
.
song_title
,
self
.
artist
,
self
.
album
,
self
.
song_length
)
self
.
album
,
self
.
song_length
)
def
get_absolute_url
(
self
):
return
reverse
(
'song_detail'
,
args
=
[
str
(
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