Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are we still doing pull requests to turn in hw, I believe this passes the Requirements for normal Night 3 #9

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a7308fa
Getting the Data Models Loaded
bekkblando Jun 30, 2015
b270b92
Error Loading in CSV
bekkblando Jun 30, 2015
f4de04d
Fixed, Added a few new things
bekkblando Jun 30, 2015
52d3bed
Moved adding to data to other file
bekkblando Jun 30, 2015
438b33a
Changed Models
bekkblando Jun 30, 2015
d3041dd
Had to switch datasets
bekkblando Jun 30, 2015
a8bc32e
Data Structure is Backwards :(
bekkblando Jun 30, 2015
7998473
Annoying error Fixed
bekkblando Jun 30, 2015
1b15b4d
Debugging Movies and Reviews
bekkblando Jun 30, 2015
02ed12c
Bug:Review Takes A Long time to run
bekkblando Jun 30, 2015
6f75205
Working on Views, URLS
bekkblando Jul 1, 2015
8bca349
Waiting on the data to load in
bekkblando Jul 1, 2015
18fe33b
Data Loaded
bekkblando Jul 1, 2015
60c9289
Getting prints setup
bekkblando Jul 1, 2015
02763d0
Yea, I think Rater has a bug
bekkblando Jul 1, 2015
5806a69
Working on top twenty Feature
bekkblando Jul 1, 2015
6dffd50
Problem Loading in Dataset
bekkblando Jul 1, 2015
df653c8
Top Twenty Works
bekkblando Jul 1, 2015
57cb1ce
Working On Top Twenty
bekkblando Jul 1, 2015
73a2575
Top Twenty Works
bekkblando Jul 1, 2015
b72b72a
Working On UI
bekkblando Jul 1, 2015
1d9d0f2
Making ratings a float
bekkblando Jul 2, 2015
d07975e
URL Modifications
bekkblando Jul 2, 2015
8d97e87
Working on Templates
bekkblando Jul 2, 2015
29ac84b
Adding Registration
bekkblando Jul 3, 2015
4d5b708
Going to add Raters/Users
bekkblando Jul 3, 2015
a687456
Making the users
bekkblando Jul 4, 2015
cbe186f
Created and linked user
bekkblando Jul 4, 2015
eb6b77d
Submit button
bekkblando Jul 4, 2015
2fcd718
Night 3 is Done
bekkblando Jul 5, 2015
51203ee
Working On Night 2 Hard
bekkblando Jul 5, 2015
be9289b
New Strategy For Learning
bekkblando Jul 6, 2015
756fbb8
Recommendations not done
bekkblando Jul 6, 2015
6380dcc
Small edits
bekkblando Jul 6, 2015
b7b6d66
Small edits broke it
bekkblando Jul 6, 2015
a3f8e20
Now fixed
bekkblando Jul 6, 2015
ae84580
Moved To Managers
bekkblando Jul 6, 2015
0a529b6
PEP8
bekkblando Jul 6, 2015
43395cb
Working on Delete
bekkblando Jul 7, 2015
c84215c
Update,Delete,Rate,+Bootstrap
bekkblando Jul 7, 2015
ba36756
Need to have Rater made on user creation
bekkblando Jul 7, 2015
0b29052
Cleaned Up
bekkblando Jul 22, 2015
2f4a1d5
Update README.md
bekkblando Aug 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ __pycache__/
*.so

# Distribution / packaging
.direnv
.Python
.idea
.envrc
movieratings/ratings.dat
movieratings/movies.dat
movieratings/users.dat
env/
build/
develop-eggs/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
I learned how to make a basic CRUD application, in addition to learning about User Premissions
# Django Movie Ratings

## Description
Expand Down
1 change: 1 addition & 0 deletions movieratings/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__author__ = 'BekkBlando'
47 changes: 47 additions & 0 deletions movieratings/load_csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
__author__ = 'BekkBlando'

from movie_stats.models import Rater, Movie, Review

# from .models import Link, Movie, Rater


def load_in(apps, scheme_editor):
print("Loaded")
with open("/Users/BekkBlando/Documents/github/django-movies/movieratings/users.dat", 'rt') as in_file:
users = in_file.read()
userslist = users.split('\n')
for item in userslist:
users5 = item.split('::')
#print("RUNNN")
if len(users5) == 5:
linkinstance = Rater.objects.create(userId=users5[0], gender=users5[1], age=int(users5[2]),
occupation=users5[3], zip=users5[4])
linkinstance.save()
print("Users Ran")

with open("/Users/BekkBlando/Documents/github/django-movies/movieratings/movies.dat", 'rt') as in_file1:
movies = in_file1.read()
movielist = movies.split("\n")
for item in movielist:
movie3 = item.split('::')
if len(movie3) == 3:
movieinstance = Movie.objects.create(movieId=movie3[0],title=movie3[1],genres=movie3[2])
movieinstance.save()
print("Movies Ran")

with open("/Users/BekkBlando/Documents/github/django-movies/movieratings/ratings.dat", 'rt') as in_file2:
review = in_file2.read()
reviewlist = review.split("\n")
print(reviewlist)
for item in reviewlist:
print(item)
review4 = item.split('::')
print("Reviews Running")
if len(review4) == 4:
reviewinstance = Review.objects.create(userId=Rater.objects.get(userId=int(review4[0])),
movieId=Movie.objects.get(movieId=review4[1]),
rating=review4[2],timestamp=review4[3])
reviewinstance.save()
print("Reviews Ran")

# raise Exception("Worked")
10 changes: 10 additions & 0 deletions movieratings/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "movieratings.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
Empty file.
9 changes: 9 additions & 0 deletions movieratings/movie_stats/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.contrib import admin

from .models import Rater, Movie, Review, Avgmovrate
# Register your models here.

admin.site.register(Rater)
admin.site.register(Movie)
admin.site.register(Review)
admin.site.register(Avgmovrate)
41 changes: 41 additions & 0 deletions movieratings/movie_stats/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
]

operations = [
migrations.CreateModel(
name='Links',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, verbose_name='ID', serialize=False)),
('movieID', models.IntegerField()),
('imdbId', models.IntegerField()),
('tmdbId', models.IntegerField()),
],
),
migrations.CreateModel(
name='Movies',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, verbose_name='ID', serialize=False)),
('movieId', models.IntegerField()),
('title', models.CharField(max_length=140)),
('genres', models.CharField(max_length=140)),
],
),
migrations.CreateModel(
name='Rater',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, verbose_name='ID', serialize=False)),
('userId', models.CharField(max_length=140)),
('movieId', models.CharField(max_length=140)),
('rating', models.DecimalField(decimal_places=2, max_digits=7)),
('timestamp', models.BigIntegerField()),
],
),
]
22 changes: 22 additions & 0 deletions movieratings/movie_stats/migrations/0002_auto_20150630_1321.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0001_initial'),
]

operations = [
migrations.RenameModel(
old_name='Links',
new_name='Link',
),
migrations.RenameModel(
old_name='Movies',
new_name='Movie',
),
]
17 changes: 17 additions & 0 deletions movieratings/movie_stats/migrations/0003_auto_20150630_1401.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations

from load_csv import load_in


class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0002_auto_20150630_1321'),
]

operations = [
#migrations.RunPython(load_in),
]
15 changes: 15 additions & 0 deletions movieratings/movie_stats/migrations/0004_auto_20150630_1525.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from load_csv import load_in

class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0003_auto_20150630_1401'),
]

operations = [
#migrations.RunPython(load_in),
]
38 changes: 38 additions & 0 deletions movieratings/movie_stats/migrations/0005_auto_20150630_2016.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0004_auto_20150630_1525'),
]

operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('userId', models.IntegerField()),
('gender', models.CharField(max_length=1)),
('age', models.IntegerField()),
('occupation', models.IntegerField()),
('zip', models.IntegerField()),
],
),
migrations.DeleteModel(
name='Link',
),
migrations.AlterField(
model_name='rater',
name='movieId',
field=models.ForeignKey(to='movie_stats.Movie'),
),
migrations.AlterField(
model_name='rater',
name='userId',
field=models.ForeignKey(to='movie_stats.User'),
),
]
72 changes: 72 additions & 0 deletions movieratings/movie_stats/migrations/0006_auto_20150630_2034.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0005_auto_20150630_2016'),
]

operations = [
migrations.CreateModel(
name='Review',
fields=[
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('rating', models.DecimalField(decimal_places=2, max_digits=7)),
('timestamp', models.BigIntegerField()),
('movieId', models.ForeignKey(to='movie_stats.Movie')),
],
),
migrations.RemoveField(
model_name='rater',
name='movieId',
),
migrations.RemoveField(
model_name='rater',
name='rating',
),
migrations.RemoveField(
model_name='rater',
name='timestamp',
),
migrations.AddField(
model_name='rater',
name='age',
field=models.IntegerField(default=1),
preserve_default=False,
),
migrations.AddField(
model_name='rater',
name='gender',
field=models.CharField(max_length=1, default='M'),
preserve_default=False,
),
migrations.AddField(
model_name='rater',
name='occupation',
field=models.IntegerField(default=7777),
preserve_default=False,
),
migrations.AddField(
model_name='rater',
name='zip',
field=models.IntegerField(default=29609),
preserve_default=False,
),
migrations.AlterField(
model_name='rater',
name='userId',
field=models.IntegerField(),
),
migrations.DeleteModel(
name='User',
),
migrations.AddField(
model_name='review',
name='userId',
field=models.ForeignKey(to='movie_stats.Rater'),
),
]
15 changes: 15 additions & 0 deletions movieratings/movie_stats/migrations/0007_auto_20150630_2110.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from load_csv import load_in

class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0006_auto_20150630_2034'),
]

operations = [

]
19 changes: 19 additions & 0 deletions movieratings/movie_stats/migrations/0008_auto_20150630_2113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0007_auto_20150630_2110'),
]

operations = [
migrations.AlterField(
model_name='rater',
name='zip',
field=models.CharField(),
),
]
15 changes: 15 additions & 0 deletions movieratings/movie_stats/migrations/0009_auto_20150630_2113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from load_csv import load_in

class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0008_auto_20150630_2113'),
]

operations = [
#migrations.RunPython(load_in),
]
19 changes: 19 additions & 0 deletions movieratings/movie_stats/migrations/0010_auto_20150630_2115.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0009_auto_20150630_2113'),
]

operations = [
migrations.AlterField(
model_name='rater',
name='occupation',
field=models.CharField(max_length=140),
),
]
15 changes: 15 additions & 0 deletions movieratings/movie_stats/migrations/0011_auto_20150630_2115.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from load_csv import load_in

class Migration(migrations.Migration):

dependencies = [
('movie_stats', '0010_auto_20150630_2115'),
]

operations = [
#migrations.RunPython(load_in),
]
Loading