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
456a10d9
Commit
456a10d9
authored
Nov 03, 2017
by
Brian Guadalupe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add string representation for the models
parent
eacd23d2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
models.py
core/models.py
+24
-14
No files found.
core/models.py
View file @
456a10d9
from
django.db
import
models
class
user_a
ccount
(
models
.
Model
):
class
UserA
ccount
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
first_name
=
models
.
CharField
(
max_length
=
64
)
last_name
=
models
.
CharField
(
max_length
=
64
)
email
=
models
.
CharField
(
max_length
=
64
)
class
a
rtist
(
models
.
Model
):
class
A
rtist
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
64
)
description
=
models
.
TextField
()
def
__str__
(
self
):
return
self
.
name
class
a
lbum
(
models
.
Model
):
class
A
lbum
(
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
)
artist
=
models
.
ForeignKey
(
Artist
)
def
__str__
(
self
):
return
self
.
album_name
class
s
ong
(
models
.
Model
):
class
S
ong
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
song_name
=
models
.
TextField
()
genre
=
models
.
CharField
(
max_length
=
128
)
song_length
=
models
.
PositiveIntegerField
(
default
=
0
,
null
=
True
)
lyrics
=
models
.
TextField
(
null
=
True
)
artist
=
models
.
ForeignKey
(
artist
)
album
=
models
.
ForeignKey
(
album
)
artist
=
models
.
ForeignKey
(
Artist
)
album
=
models
.
ForeignKey
(
Album
)
def
__str__
(
self
):
return
self
.
song_name
class
music_p
laylist
(
models
.
Model
):
class
MusicP
laylist
(
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
)
user
=
models
.
ForeignKey
(
UserAccount
)
def
__str__
(
self
):
return
self
.
playlist_name
class
music_e
ntry
(
models
.
Model
):
class
MusicE
ntry
(
models
.
Model
):
RATING_CHOICES
=
(
(
0
,
'1'
),
(
1
,
'2'
),
...
...
@@ -48,10 +56,12 @@ class music_entry(models.Model):
id
=
models
.
AutoField
(
primary_key
=
True
)
order_in_playlist
=
models
.
PositiveSmallIntegerField
()
rating
=
models
.
DecimalField
(
max_digits
=
1
,
decimal_places
=
0
,
choices
=
RATING_CHOICES
)
playlist
=
models
.
ForeignKey
(
music_p
laylist
)
song
=
models
.
ForeignKey
(
s
ong
)
playlist
=
models
.
ForeignKey
(
MusicP
laylist
)
song
=
models
.
ForeignKey
(
S
ong
)
class
t
ag
(
models
.
Model
):
class
T
ag
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
32
)
tag
=
models
.
ManyToManyField
(
music_entry
)
tag
=
models
.
ManyToManyField
(
MusicEntry
)
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