Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lance_tan_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
Lance Cedric Tan
lance_tan_music
Commits
5999e1a6
Commit
5999e1a6
authored
Feb 16, 2023
by
Lance Cedric Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accomplished Homepage app
parent
34ee46d3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
1 deletion
+112
-1
.DS_Store
.DS_Store
+0
-0
0001_initial.py
Homepage/migrations/0001_initial.py
+47
-0
models.py
Homepage/models.py
+46
-0
urls.py
Homepage/urls.py
+10
-0
views.py
Homepage/views.py
+6
-0
db.sqlite3
db.sqlite3
+0
-0
settings.py
lance_tan_music/settings.py
+1
-0
urls.py
lance_tan_music/urls.py
+2
-1
No files found.
.DS_Store
View file @
5999e1a6
No preview for this file type
Homepage/migrations/0001_initial.py
0 → 100644
View file @
5999e1a6
# Generated by Django 3.2 on 2023-02-16 12:26
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
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'album_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'description'
,
models
.
CharField
(
max_length
=
255
)),
(
'release_date'
,
models
.
CharField
(
max_length
=
255
)),
],
),
migrations
.
CreateModel
(
name
=
'Artist'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'artist_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'monthly_listeners'
,
models
.
IntegerField
()),
],
),
migrations
.
CreateModel
(
name
=
'SongInfo'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'song_title'
,
models
.
CharField
(
max_length
=
255
)),
(
'song_length'
,
models
.
IntegerField
()),
(
'album'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'Homepage.album'
)),
(
'artist'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'Homepage.artist'
)),
],
),
migrations
.
AddField
(
model_name
=
'album'
,
name
=
'artist'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'Homepage.artist'
),
),
]
Homepage/models.py
View file @
5999e1a6
from
django.db
import
models
from
django.db
import
models
# Create your models here.
# Create your models here.
from
django.db
import
models
from
django.urls
import
reverse
class
Artist
(
models
.
Model
):
artist_name
=
models
.
CharField
(
max_length
=
255
)
monthly_listeners
=
models
.
IntegerField
()
def
__str__
(
self
):
return
artist_name
def
get_absolute_url
(
self
):
return
reverse
(
'artist'
,
args
=
[
str
(
self
.
artist_name
)])
class
Album
(
models
.
Model
):
album_name
=
models
.
CharField
(
max_length
=
255
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
description
=
models
.
CharField
(
max_length
=
255
)
release_date
=
models
.
CharField
(
max_length
=
255
)
def
__str__
(
self
):
return
album_name
def
get_absolute_url
(
self
):
return
reverse
(
'album'
,
args
=
[
str
(
self
.
album_name
)])
class
SongInfo
(
models
.
Model
):
song_title
=
models
.
CharField
(
max_length
=
255
)
artist
=
models
.
ForeignKey
(
Artist
,
on_delete
=
models
.
CASCADE
)
album
=
models
.
ForeignKey
(
Album
,
on_delete
=
models
.
CASCADE
)
song_length
=
models
.
IntegerField
()
def
__str__
(
self
):
return
song_title
def
get_absolute_url
(
self
):
return
reverse
(
'song'
,
args
=
[
str
(
self
.
song_title
)])
Homepage/urls.py
0 → 100644
View file @
5999e1a6
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"Homepage"
Homepage/views.py
View file @
5999e1a6
from
django.shortcuts
import
render
from
django.shortcuts
import
render
# Create your views here.
# Create your views here.
from
django.http
import
HttpResponse
def
index
(
request
):
return
HttpResponse
(
"Welcome to Lance's Music Library"
)
db.sqlite3
0 → 100644
View file @
5999e1a6
File added
lance_tan_music/settings.py
View file @
5999e1a6
...
@@ -43,6 +43,7 @@ INSTALLED_APPS = [
...
@@ -43,6 +43,7 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django.contrib.staticfiles'
,
'Homepage'
,
]
]
MIDDLEWARE
=
[
MIDDLEWARE
=
[
...
...
lance_tan_music/urls.py
View file @
5999e1a6
...
@@ -14,8 +14,9 @@ Including another URLconf
...
@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
"""
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.urls
import
path
from
django.urls
import
include
,
path
urlpatterns
=
[
urlpatterns
=
[
path
(
'Homepage'
,
include
(
'Homepage.urls'
,
namespace
=
"Homepage"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
]
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