Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
django-panik-nonstop
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
radiopanik
django-panik-nonstop
Commits
1af95e39
Commit
1af95e39
authored
Oct 03, 2017
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add uploader info to tracks
parent
ef0f3886
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
nonstop/migrations/0008_track_uploader.py
nonstop/migrations/0008_track_uploader.py
+21
-0
nonstop/models.py
nonstop/models.py
+2
-0
nonstop/views.py
nonstop/views.py
+2
-1
No files found.
nonstop/migrations/0008_track_uploader.py
0 → 100644
View file @
1af95e39
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
from
django.conf
import
settings
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
(
'nonstop'
,
'0007_auto_20171003_1022'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'track'
,
name
=
'uploader'
,
field
=
models
.
ForeignKey
(
to
=
settings
.
AUTH_USER_MODEL
,
null
=
True
),
),
]
nonstop/models.py
View file @
1af95e39
...
...
@@ -2,6 +2,7 @@ import os
import
mutagen
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -57,6 +58,7 @@ class Track(models.Model):
nonstop_zones
=
models
.
ManyToManyField
(
'emissions.Nonstop'
,
blank
=
True
)
creation_timestamp
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
)
uploader
=
models
.
ForeignKey
(
settings
.
AUTH_USER_MODEL
,
null
=
True
)
class
Meta
:
ordering
=
[
'creation_timestamp'
]
...
...
nonstop/views.py
View file @
1af95e39
...
...
@@ -206,7 +206,8 @@ class UploadTracksView(FormView):
nonstop_file
=
NonstopFile
()
nonstop_file
.
set_track_filepath
(
filepath
)
artist
,
created
=
Artist
.
objects
.
get_or_create
(
name
=
artist_name
)
track
,
created
=
Track
.
objects
.
get_or_create
(
title
=
track_title
,
artist
=
artist
)
track
,
created
=
Track
.
objects
.
get_or_create
(
title
=
track_title
,
artist
=
artist
,
defaults
=
{
'uploader'
:
self
.
request
.
user
})
nonstop_file
.
track
=
track
nonstop_file
.
save
()
nonstop_file
.
track
.
sync_nonstop_zones
()
...
...
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