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
9329ab0e
Commit
9329ab0e
authored
Nov 03, 2017
by
Brian Guadalupe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DB migrations
parent
112824b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
12 deletions
+154
-12
0001_initial.py
core/migrations/0001_initial.py
+98
-0
0002_auto_20171103_1546.py
core/migrations/0002_auto_20171103_1546.py
+44
-0
models.py
core/models.py
+12
-12
No files found.
core/migrations/0001_initial.py
0 → 100644
View file @
9329ab0e
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-03 04:59
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'album'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'album_name'
,
models
.
CharField
(
max_length
=
64
)),
(
'year'
,
models
.
DecimalField
(
decimal_places
=
0
,
max_digits
=
4
)),
],
),
migrations
.
CreateModel
(
name
=
'artist'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'name'
,
models
.
CharField
(
max_length
=
64
)),
(
'description'
,
models
.
TextField
()),
],
),
migrations
.
CreateModel
(
name
=
'music_entry'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'order_in_playlist'
,
models
.
PositiveSmallIntegerField
()),
(
'rating'
,
models
.
DecimalField
(
choices
=
[(
0
,
'1'
),
(
1
,
'2'
),
(
2
,
'3'
),
(
3
,
'4'
),
(
4
,
'5'
),
(
5
,
'6'
),
(
6
,
'7'
),
(
7
,
'8'
),
(
8
,
'9'
),
(
9
,
'10'
)],
decimal_places
=
0
,
max_digits
=
1
)),
],
),
migrations
.
CreateModel
(
name
=
'music_playlist'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'playlist_name'
,
models
.
CharField
(
max_length
=
32
)),
(
'is_public'
,
models
.
BooleanField
(
default
=
False
)),
],
),
migrations
.
CreateModel
(
name
=
'song'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'song_name'
,
models
.
TextField
()),
(
'genre'
,
models
.
CharField
(
max_length
=
128
)),
(
'song_length'
,
models
.
PositiveIntegerField
(
default
=
0
,
null
=
True
)),
(
'lyrics'
,
models
.
TextField
(
null
=
True
)),
(
'album'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.album'
)),
(
'artist'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.artist'
)),
],
),
migrations
.
CreateModel
(
name
=
'tag'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'name'
,
models
.
CharField
(
max_length
=
32
)),
(
'tag'
,
models
.
ManyToManyField
(
to
=
'core.music_entry'
)),
],
),
migrations
.
CreateModel
(
name
=
'user_account'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'first_name'
,
models
.
CharField
(
max_length
=
64
)),
(
'last_name'
,
models
.
CharField
(
max_length
=
64
)),
(
'email'
,
models
.
CharField
(
max_length
=
64
)),
],
),
migrations
.
AddField
(
model_name
=
'music_playlist'
,
name
=
'user'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.user_account'
),
),
migrations
.
AddField
(
model_name
=
'music_entry'
,
name
=
'playlist'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.music_playlist'
),
),
migrations
.
AddField
(
model_name
=
'music_entry'
,
name
=
'song'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.song'
),
),
migrations
.
AddField
(
model_name
=
'album'
,
name
=
'artist'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.artist'
),
),
]
core/migrations/0002_auto_20171103_1546.py
0 → 100644
View file @
9329ab0e
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-03 07:46
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RenameModel
(
old_name
=
'music_entry'
,
new_name
=
'MusicEntry'
,
),
migrations
.
RenameModel
(
old_name
=
'music_playlist'
,
new_name
=
'MusicPlaylist'
,
),
migrations
.
AlterField
(
model_name
=
'album'
,
name
=
'artist'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.Artist'
),
),
migrations
.
AlterField
(
model_name
=
'musicentry'
,
name
=
'song'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.Song'
),
),
migrations
.
AlterField
(
model_name
=
'song'
,
name
=
'album'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.Album'
),
),
migrations
.
AlterField
(
model_name
=
'song'
,
name
=
'artist'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'core.Artist'
),
),
]
core/models.py
View file @
9329ab0e
...
@@ -6,33 +6,33 @@ class user_account(models.Model):
...
@@ -6,33 +6,33 @@ class user_account(models.Model):
last_name
=
models
.
CharField
(
max_length
=
64
)
last_name
=
models
.
CharField
(
max_length
=
64
)
email
=
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
)
id
=
models
.
AutoField
(
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
64
)
name
=
models
.
CharField
(
max_length
=
64
)
description
=
models
.
TextField
()
description
=
models
.
TextField
()
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
self
.
name
class
a
lbum
(
models
.
Model
):
class
A
lbum
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
id
=
models
.
AutoField
(
primary_key
=
True
)
album_name
=
models
.
CharField
(
max_length
=
64
)
album_name
=
models
.
CharField
(
max_length
=
64
)
year
=
models
.
DecimalField
(
max_digits
=
4
,
decimal_places
=
0
)
year
=
models
.
DecimalField
(
max_digits
=
4
,
decimal_places
=
0
)
artist
=
models
.
ForeignKey
(
a
rtist
)
artist
=
models
.
ForeignKey
(
A
rtist
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
album_name
return
self
.
album_name
class
s
ong
(
models
.
Model
):
class
S
ong
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
id
=
models
.
AutoField
(
primary_key
=
True
)
song_name
=
models
.
TextField
()
song_name
=
models
.
TextField
()
genre
=
models
.
CharField
(
max_length
=
128
)
genre
=
models
.
CharField
(
max_length
=
128
)
song_length
=
models
.
PositiveIntegerField
(
default
=
0
,
null
=
True
)
song_length
=
models
.
PositiveIntegerField
(
default
=
0
,
null
=
True
)
lyrics
=
models
.
TextField
(
null
=
True
)
lyrics
=
models
.
TextField
(
null
=
True
)
a
rtist
=
models
.
ForeignKey
(
artist
)
a
lbum
=
models
.
ForeignKey
(
Album
)
a
lbum
=
models
.
ForeignKey
(
album
)
a
rtist
=
models
.
ForeignKey
(
Artist
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
song_name
return
self
.
song_name
class
music_p
laylist
(
models
.
Model
):
class
MusicP
laylist
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
id
=
models
.
AutoField
(
primary_key
=
True
)
playlist_name
=
models
.
CharField
(
max_length
=
32
)
playlist_name
=
models
.
CharField
(
max_length
=
32
)
is_public
=
models
.
BooleanField
(
default
=
False
)
is_public
=
models
.
BooleanField
(
default
=
False
)
...
@@ -40,7 +40,7 @@ class music_playlist(models.Model):
...
@@ -40,7 +40,7 @@ class music_playlist(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
playlist_name
return
self
.
playlist_name
class
music_e
ntry
(
models
.
Model
):
class
MusicE
ntry
(
models
.
Model
):
RATING_CHOICES
=
(
RATING_CHOICES
=
(
(
0
,
'1'
),
(
0
,
'1'
),
(
1
,
'2'
),
(
1
,
'2'
),
...
@@ -56,12 +56,12 @@ class music_entry(models.Model):
...
@@ -56,12 +56,12 @@ class music_entry(models.Model):
id
=
models
.
AutoField
(
primary_key
=
True
)
id
=
models
.
AutoField
(
primary_key
=
True
)
order_in_playlist
=
models
.
PositiveSmallIntegerField
()
order_in_playlist
=
models
.
PositiveSmallIntegerField
()
rating
=
models
.
DecimalField
(
max_digits
=
1
,
decimal_places
=
0
,
choices
=
RATING_CHOICES
)
rating
=
models
.
DecimalField
(
max_digits
=
1
,
decimal_places
=
0
,
choices
=
RATING_CHOICES
)
playlist
=
models
.
ForeignKey
(
music_p
laylist
)
playlist
=
models
.
ForeignKey
(
MusicP
laylist
)
song
=
models
.
ForeignKey
(
s
ong
)
song
=
models
.
ForeignKey
(
S
ong
)
class
t
ag
(
models
.
Model
):
class
T
ag
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
id
=
models
.
AutoField
(
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
32
)
name
=
models
.
CharField
(
max_length
=
32
)
tag
=
models
.
ManyToManyField
(
music_e
ntry
)
tag
=
models
.
ManyToManyField
(
MusicE
ntry
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
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