Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mymusiclist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Brian Guadalupe
mymusiclist
Commits
8862b738
Commit
8862b738
authored
Nov 03, 2017
by
Brian Guadalupe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add string representation of models
parent
eacd23d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
models.py
core/models.py
+10
-0
No files found.
core/models.py
View file @
8862b738
...
...
@@ -10,12 +10,16 @@ class artist(models.Model):
id
=
models
.
AutoField
(
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
64
)
description
=
models
.
TextField
()
def
__str__
(
self
):
return
self
.
name
class
album
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
album_name
=
models
.
CharField
(
max_length
=
64
)
year
=
models
.
DecimalField
(
max_digits
=
4
,
decimal_places
=
0
)
artist
=
models
.
ForeignKey
(
artist
)
def
__str__
(
self
):
return
self
.
album_name
class
song
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
...
...
@@ -25,12 +29,16 @@ class song(models.Model):
lyrics
=
models
.
TextField
(
null
=
True
)
artist
=
models
.
ForeignKey
(
artist
)
album
=
models
.
ForeignKey
(
album
)
def
__str__
(
self
):
return
self
.
song_name
class
music_playlist
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
playlist_name
=
models
.
CharField
(
max_length
=
32
)
is_public
=
models
.
BooleanField
(
default
=
False
)
user
=
models
.
ForeignKey
(
user_account
)
def
__str__
(
self
):
return
self
.
playlist_name
class
music_entry
(
models
.
Model
):
RATING_CHOICES
=
(
...
...
@@ -55,3 +63,5 @@ class tag(models.Model):
id
=
models
.
AutoField
(
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
32
)
tag
=
models
.
ManyToManyField
(
music_entry
)
def
__str__
(
self
):
return
self
.
name
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