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
240264c1
Commit
240264c1
authored
Nov 01, 2017
by
Gink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds models in model.py for database integration with Django
parent
b2cc5ac2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
15 deletions
+67
-15
extract.sql
SQL/extract.sql
+5
-1
mymusiclist.sql
SQL/mymusiclist.sql
+1
-1
models.py
core/models.py
+52
-12
mymusiclist.css
files/css/mymusiclist.css
+1
-1
PalanquinDark-Bold.ttf
files/fonts/PalanquinDark-Bold.ttf
+0
-0
PalanquinDark-Medium.ttf
files/fonts/PalanquinDark-Medium.ttf
+0
-0
PalanquinDark-Regular.ttf
files/fonts/PalanquinDark-Regular.ttf
+0
-0
PalanquinDark-SemiBold.ttf
files/fonts/PalanquinDark-SemiBold.ttf
+0
-0
settings.py
mymusiclist/settings.py
+1
-0
base.html
templates/base.html
+7
-0
No files found.
SQL/extract.sql
View file @
240264c1
-- Do NOT RUN
--artist extraction
INSERT
INTO
artist
(
id
,
name
,
description
)
select
ag
.
artistid
,
ag
.
name
,
"No description available"
from
artists_group
ag
where
ag
.
name
in
(
...
...
@@ -27,12 +29,14 @@ select ag.artistid, ag.name, "No description available" from artists_group ag wh
"Post Malone"
);
--album extraction
INSERT
INTO
album
(
id
,
album_name
,
year
,
artist_id
)
select
distinct
tg
.
id
,
name
,
year
,
(
select
artistid
from
torrents_artists
where
groupid
=
tg
.
id
order
by
importance
asc
limit
1
)
as
artistidv
select
tg
.
id
,
name
,
year
,
(
select
artistid
from
torrents_artists
where
groupid
=
tg
.
id
order
by
importance
asc
limit
1
)
as
artistidv
from
torrents_group
tg
join
torrents_artists
ta
on
ta
.
groupid
=
tg
.
id
where
(
select
artistid
from
torrents_artists
where
groupid
=
tg
.
id
order
by
importance
asc
limit
1
)
in
(
select
id
from
artist
)
and
(
ta
.
artistid
in
(
select
id
from
artist
))
and
tg
.
releasetype
=
1
order
by
tg
.
id
;
--song extraction
INSERT
INTO
song
(
song_name
,
genre
,
artist_id
,
album_id
)
select
(
select
filelist
from
torrents
where
groupid
=
album
.
id
order
by
time
desc
limit
1
),
tg
.
taglist
,
artist
.
id
,
album
.
id
from
artist
join
album
on
album
.
artist_id
=
artist
.
id
join
torrents_group
tg
on
tg
.
id
=
album
.
id
;
...
...
SQL/mymusiclist.sql
View file @
240264c1
...
...
@@ -34,9 +34,9 @@ create table song(
create
table
music_playlist
(
id
int
unique
primary
key
auto_increment
,
owner_id
int
,
playlist_name
varchar
(
32
)
not
null
,
is_public
boolean
not
null
,
owner_id
int
,
FOREIGN
KEY
(
owner_id
)
REFERENCES
user_account
(
id
)
);
...
...
core/models.py
View file @
240264c1
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
# Create your models here.
class
user_account
(
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 Profile(models.Model):
# user = models.OneToOneField(User, on_delete=models.CASCADE)
# first_name = models.TextField(max_length=255)
# last_name = models.TextField(max_length=255)
# email_address = models.EmailField(max_length=255)
class
artist
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
true
)
name
=
models
.
CharField
(
max_length
=
64
)
description
=
models
.
TextField
()
@
receiver
(
post_save
,
sender
=
User
)
def
update_user_profile
(
sender
,
instance
,
created
,
**
kwargs
):
if
created
:
Profile
.
objects
.
create
(
user
=
instance
)
instance
.
profile
.
save
()
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
)
# FOREIGN KEY artist_id
class
song
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
true
)
song_name
=
models
.
TextField
()
genre
=
models
.
CharField
(
max_length
=
128
)
song_length
=
models
.
PositiveIntegerField
(
default
=
0
)
lyrics
=
models
.
TextField
()
#FOREIGN KEY ARTISTID
#FOREIGN KEY ALBUMID
class
music_playlist
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
true
)
playlist_name
=
models
.
CharField
(
max_length
=
32
)
is_public
=
models
.
BooleanField
(
default
=
false
)
#FOREIGN KEY TO user_account
class
music_entry
(
models
.
Model
):
RATING_CHOICES
=
(
(
0
,
'1'
),
(
1
,
'2'
),
(
2
,
'3'
),
(
3
,
'4'
),
(
4
,
'5'
),
(
5
,
'6'
),
(
6
,
'7'
),
(
7
,
'8'
),
(
8
,
'9'
),
(
9
,
'10'
)
)
id
=
models
.
AutoField
(
primary_key
=
true
)
order_in_playlist
=
models
.
PositiveSmallIntegerField
()
rating
=
models
.
DecimalField
(
max_digits
=
1
,
decimal_places
=
0
,
choices
=
RATING_CHOICES
)
#FOREIGN KEY TO PLAYLIST
#FOREIGN KEY TO SONG
class
tag
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
true
)
name
=
models
.
CharField
(
max_length
=
32
)
\ No newline at end of file
files/css/mymusiclist.css
View file @
240264c1
...
...
@@ -122,7 +122,7 @@ body {
@font-face
{
font-family
:
'PalanquinDark'
;
src
:
url('
../fonts
/PalanquinDark-Regular.ttf')
;
src
:
url('
/files/fonts/palanquindark
/PalanquinDark-Regular.ttf')
;
}
files/fonts/PalanquinDark-Bold.ttf
deleted
100644 → 0
View file @
b2cc5ac2
File deleted
files/fonts/PalanquinDark-Medium.ttf
deleted
100644 → 0
View file @
b2cc5ac2
File deleted
files/fonts/PalanquinDark-Regular.ttf
deleted
100644 → 0
View file @
b2cc5ac2
File deleted
files/fonts/PalanquinDark-SemiBold.ttf
deleted
100644 → 0
View file @
b2cc5ac2
File deleted
mymusiclist/settings.py
View file @
240264c1
...
...
@@ -104,6 +104,7 @@ STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.FileSystemFinder"
,
"django.contrib.staticfiles.finders.AppDirectoriesFinder"
,
]
STATICFILES_DIRS
=
[
os
.
path
.
join
(
BASE_DIR
,
"files"
),
]
...
...
templates/base.html
View file @
240264c1
...
...
@@ -4,6 +4,7 @@
<meta
charset=
"utf-8"
>
<title>
{% block title %}MyMusicList{% endblock %}
</title>
<link
rel=
"stylesheet"
href=
"/files/css/mymusiclist.css"
>
<link
rel=
"stylesheet"
href=
"/files/css/font-awesome.css"
>
</head>
<body>
<header>
...
...
@@ -18,6 +19,7 @@
<li><a
class=
"nav_bar_home"
href=
"/"
>
MyMusicList
</a></li>
<li><a
class=
"nav_bar_tab"
href=
"{% url 'login' %}"
>
LOGIN
</a></li>
<li><a
class=
"nav_bar_tab"
href=
"{% url 'signup' %}"
>
SIGN UP
</a></li>
<li
style=
"float:right"
><button
class=
"nav_bar_tab"
type=
"button"
onclick=
"toggleWallpaper()"
></button></li>
</ul>
{% endif %}
</header>
...
...
@@ -34,5 +36,10 @@
{% block content %}
{% endblock %}
</main>
<script>
function
toggleWallpaper
()
{
document
.
getElementByID
(
"nav_bar"
).
style
.
background
-
color
=
"white"
;
}
</script>
</body>
</html>
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