summaryrefslogtreecommitdiff
path: root/commentingapp
diff options
context:
space:
mode:
authorTrupti Rajesh Kini2016-10-24 15:00:37 +0530
committerGitHub2016-10-24 15:00:37 +0530
commit27d47a26dd9c7765bbfda112eddbebe8f3679460 (patch)
tree4c26ad501f9387e3d16c389603ae1432bd2c64fd /commentingapp
parentc5c3c7b6c4794d960ead6137d251cd9b8f423aa4 (diff)
parenteb3321f80def84e84329f213e21ef5ac94d4ccd6 (diff)
downloadPython-TBC-Interface-27d47a26dd9c7765bbfda112eddbebe8f3679460.tar.gz
Python-TBC-Interface-27d47a26dd9c7765bbfda112eddbebe8f3679460.tar.bz2
Python-TBC-Interface-27d47a26dd9c7765bbfda112eddbebe8f3679460.zip
Merge pull request #2 from kinitrupti/upgrade-django-1.9
Upgrade django 1.9
Diffstat (limited to 'commentingapp')
-rw-r--r--commentingapp/commenting_new.py6
-rw-r--r--commentingapp/models.py5
-rw-r--r--commentingapp/views.py2
3 files changed, 6 insertions, 7 deletions
diff --git a/commentingapp/commenting_new.py b/commentingapp/commenting_new.py
index 33f4923..77c0fc5 100644
--- a/commentingapp/commenting_new.py
+++ b/commentingapp/commenting_new.py
@@ -3,7 +3,7 @@
import requests
import collections
import os
-from urlparse import urljoin
+from urllib.parse import urljoin
@@ -75,7 +75,7 @@ class DisqusCommenting(object):
json_like_list = []
- for thread_id in self.counter.keys(): # Find a better way to do this
+ for thread_id in list(self.counter.keys()): # Find a better way to do this
comment_list = []
payload = {"api_key": self.public_key, "thread": thread_id}
thread_url = urljoin(self.base_disqus_url,self.api_version)+"/threads/list.json"
@@ -103,4 +103,4 @@ if __name__ == "__main__":
z = x.get_thread_ids()
z1 = x.get_comments()
- print z1 # this will print out a json like list of all the urls and the comments on each url
+ print(z1) # this will print out a json like list of all the urls and the comments on each url
diff --git a/commentingapp/models.py b/commentingapp/models.py
index 79e120e..66ae0a1 100644
--- a/commentingapp/models.py
+++ b/commentingapp/models.py
@@ -1,4 +1,3 @@
-from __future__ import unicode_literals
from django.db import models
from tbc.models import Chapters, Book
from django.contrib.auth.models import User
@@ -14,9 +13,9 @@ class Url (models.Model):
url = models.URLField()
def get_contributor_details(self, counter):
- notebooks = [os.path.join(chapter_name.split("/")[-2], chapter_name.split('/')[-1]) for chapter_name in counter.keys()]
+ notebooks = [os.path.join(chapter_name.split("/")[-2], chapter_name.split('/')[-1]) for chapter_name in list(counter.keys())]
contributor_list = []
- for notebook,url,number_of_comments in zip(notebooks, counter.keys(), counter.values()):
+ for notebook,url,number_of_comments in zip(notebooks, list(counter.keys()), list(counter.values())):
contributor_dict = {}
contributor_id = Book.objects.filter(Q(chapters__notebook = notebook)).values_list("contributor_id", flat = True)
contributor = User.objects.filter(id = contributor_id[0]).values("email", "first_name", "last_name")
diff --git a/commentingapp/views.py b/commentingapp/views.py
index 66606b7..80f37e8 100644
--- a/commentingapp/views.py
+++ b/commentingapp/views.py
@@ -1,6 +1,6 @@
from django.shortcuts import render, render_to_response
from django.contrib.auth.decorators import login_required
-from django.core.context_processors import csrf
+from django.template.context_processors import csrf
from .models import Url, Comments
from django.db.models import Q
from collections import Counter