Browse Source
Merge pull request #29 from chrisshyi/in-progress
Merge pull request #29 from chrisshyi/in-progress
Cleaned up views.py and utils.pymaster
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 251 deletions
-
79spotifyvis/migrations/0001_initial.py
-
53spotifyvis/migrations/0002_auto_20180606_0523.py
-
23spotifyvis/migrations/0003_auto_20180606_0525.py
-
16spotifyvis/models.py
-
11spotifyvis/static/spotifyvis/scripts/test_db.js
-
11spotifyvis/templates/spotifyvis/test_db.html
-
1spotifyvis/templates/spotifyvis/user_data.html
-
95spotifyvis/utils.py
-
22spotifyvis/views.py
@ -1,79 +0,0 @@ |
|||||
# Generated by Django 2.0.5 on 2018-06-06 07:26 |
|
||||
|
|
||||
from django.db import migrations, models |
|
||||
import django.db.models.deletion |
|
||||
|
|
||||
|
|
||||
class Migration(migrations.Migration): |
|
||||
|
|
||||
initial = True |
|
||||
|
|
||||
dependencies = [ |
|
||||
] |
|
||||
|
|
||||
operations = [ |
|
||||
migrations.CreateModel( |
|
||||
name='Artist', |
|
||||
fields=[ |
|
||||
('artist_id', models.CharField(max_length=30, primary_key=True, serialize=False)), |
|
||||
('name', models.CharField(max_length=50, unique=True)), |
|
||||
('genre', models.CharField(max_length=20)), |
|
||||
], |
|
||||
options={ |
|
||||
'verbose_name_plural': 'Artists', |
|
||||
'verbose_name': 'Artist', |
|
||||
}, |
|
||||
), |
|
||||
migrations.CreateModel( |
|
||||
name='Track', |
|
||||
fields=[ |
|
||||
('track_id', models.CharField(max_length=30, primary_key=True, serialize=False)), |
|
||||
('year', models.PositiveSmallIntegerField()), |
|
||||
('popularity', models.PositiveSmallIntegerField()), |
|
||||
('runtime', models.PositiveSmallIntegerField()), |
|
||||
('name', models.CharField(max_length=75)), |
|
||||
], |
|
||||
options={ |
|
||||
'verbose_name_plural': 'Tracks', |
|
||||
'verbose_name': 'Track', |
|
||||
}, |
|
||||
), |
|
||||
migrations.CreateModel( |
|
||||
name='User', |
|
||||
fields=[ |
|
||||
('user_id', models.CharField(max_length=30, primary_key=True, serialize=False)), |
|
||||
], |
|
||||
options={ |
|
||||
'verbose_name_plural': 'Users', |
|
||||
'verbose_name': 'User', |
|
||||
}, |
|
||||
), |
|
||||
migrations.CreateModel( |
|
||||
name='AudioFeatures', |
|
||||
fields=[ |
|
||||
('track', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='spotifyvis.Track')), |
|
||||
('danceability', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
('energy', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
('loudness', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
('speechiness', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
('acousticness', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
('instrumentalness', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
('valence', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
('tempo', models.DecimalField(decimal_places=2, max_digits=2)), |
|
||||
], |
|
||||
options={ |
|
||||
'verbose_name_plural': 'AudioFeatures', |
|
||||
'verbose_name': 'AudioFeatures', |
|
||||
}, |
|
||||
), |
|
||||
migrations.AddField( |
|
||||
model_name='track', |
|
||||
name='artists', |
|
||||
field=models.ManyToManyField(blank=True, to='spotifyvis.Artist'), |
|
||||
), |
|
||||
migrations.AddField( |
|
||||
model_name='track', |
|
||||
name='users', |
|
||||
field=models.ManyToManyField(blank=True, to='spotifyvis.User'), |
|
||||
), |
|
||||
] |
|
@ -1,53 +0,0 @@ |
|||||
# Generated by Django 2.0.5 on 2018-06-06 09:23 |
|
||||
|
|
||||
from django.db import migrations, models |
|
||||
|
|
||||
|
|
||||
class Migration(migrations.Migration): |
|
||||
|
|
||||
dependencies = [ |
|
||||
('spotifyvis', '0001_initial'), |
|
||||
] |
|
||||
|
|
||||
operations = [ |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='acousticness', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='danceability', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='energy', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='instrumentalness', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='loudness', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='speechiness', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='tempo', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='valence', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=3), |
|
||||
), |
|
||||
] |
|
@ -1,23 +0,0 @@ |
|||||
# Generated by Django 2.0.5 on 2018-06-06 09:25 |
|
||||
|
|
||||
from django.db import migrations, models |
|
||||
|
|
||||
|
|
||||
class Migration(migrations.Migration): |
|
||||
|
|
||||
dependencies = [ |
|
||||
('spotifyvis', '0002_auto_20180606_0523'), |
|
||||
] |
|
||||
|
|
||||
operations = [ |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='loudness', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=6), |
|
||||
), |
|
||||
migrations.AlterField( |
|
||||
model_name='audiofeatures', |
|
||||
name='tempo', |
|
||||
field=models.DecimalField(decimal_places=3, max_digits=6), |
|
||||
), |
|
||||
] |
|
@ -1,11 +0,0 @@ |
|||||
console.log("{{ user_id }}"); |
|
||||
artist_data = JSON.parse('{{ artist_data }}'); |
|
||||
artist_data.forEach(function(d) { |
|
||||
console.log(d.name, d.num_songs); |
|
||||
}); |
|
||||
|
|
||||
d3.json("{% url "get_artist_data" user_id %}", function(error, data) { |
|
||||
data.forEach(function(d) { |
|
||||
console.log(d.name, d.num_songs); |
|
||||
}); |
|
||||
}); |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue