Skip to content

Commit

Permalink
Making the new user model work with id on username.
Browse files Browse the repository at this point in the history
  • Loading branch information
ca9 committed Jul 10, 2014
1 parent c596b47 commit 8053caf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions coursereview/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def getTopReviewers(n):
d[x.reviewer][1] += 1
else:
d[x.reviewer] = [x.upvotes, 1]
votes = [[d[x][0], d[x][1], UserProfile.objects.get(user=x).name] for x in d.keys()]
revs = [[d[x][1], d[x][0], UserProfile.objects.get(user=x).name] for x in d.keys()]
votes = [[d[x][0], d[x][1], UserProfile.objects.get(username=x).name] for x in d.keys()]
revs = [[d[x][1], d[x][0], UserProfile.objects.get(username=x).name] for x in d.keys()]
votes.sort()
revs.sort()
print votes, revs
Expand Down
4 changes: 2 additions & 2 deletions coursereview/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def watch(request):
courseID = GET[u'myCourse']
courseID = courseID.encode('ascii', 'ignore')
text = GET[u'text']
myUser = UserProfile.objects.get(email = GET[u'myUser'])
myUser = UserProfile.objects.get(username = GET[u'myUser'])
myCourse = Course.objects.get(courseID = courseID)
if text == u"Watch":
myUser.watchList.add(myCourse)
Expand Down Expand Up @@ -386,7 +386,7 @@ def report(request):
GET = request.GET
if GET.has_key(u'pk'):
pk = int(GET[u'pk'])
myUser = UserProfile.objects.get(email = GET[u'myUser'])
myUser = UserProfile.objects.get(username = GET[u'myUser'])
myReview = Review.objects.get(pk=pk)
results['mess'] = "You have already reported this review."
if myUser not in myReview.reporter.all():
Expand Down

0 comments on commit 8053caf

Please sign in to comment.