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

Python 3 support #105

Closed
rnegron opened this issue Aug 26, 2018 · 1 comment
Closed

Python 3 support #105

rnegron opened this issue Aug 26, 2018 · 1 comment

Comments

@rnegron
Copy link
Collaborator

rnegron commented Aug 26, 2018

Django 2.x dropped Python 2 support. Getting the project up and running on Python 3 is a necessary step towards 2.x compatibility!

I ran 2to3 on the repo and obtained the following diff:

--- ./notaso/comments/migrations/0001_initial.py	(original)
+++ ./notaso/comments/migrations/0001_initial.py	(refactored)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 # Generated by Django 1.11.15 on 2018-08-19 16:53
-from __future__ import unicode_literals
+
 
 import django.db.models.deletion
 from django.conf import settings
--- ./notaso/departments/migrations/0001_initial.py	(original)
+++ ./notaso/departments/migrations/0001_initial.py	(refactored)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 # Generated by Django 1.11.15 on 2018-08-19 16:52
-from __future__ import unicode_literals
+
 
 from django.db import migrations, models
 
--- ./notaso/professors/models.py	(original)
+++ ./notaso/professors/models.py	(refactored)
@@ -39,7 +39,7 @@
     )
 
     def __unicode__(self):
-        return u"%s %s" % (self.first_name, self.last_name)
+        return "%s %s" % (self.first_name, self.last_name)
 
     def get_full_name(self):
         full_name = "%s %s" % (self.first_name, self.last_name)
--- ./notaso/professors/migrations/0001_initial.py	(original)
+++ ./notaso/professors/migrations/0001_initial.py	(refactored)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 # Generated by Django 1.11.15 on 2018-08-18 23:33
-from __future__ import unicode_literals
+
 
 import django.db.models.deletion
 from django.conf import settings
--- ./notaso/universities/models.py	(original)
+++ ./notaso/universities/models.py	(refactored)
@@ -14,7 +14,7 @@
     slug = models.SlugField(null=False)
 
     def __unicode__(self):
-        return u"%s %s" % (self.name, self.city)
+        return "%s %s" % (self.name, self.city)
 
     def save(self, *args, **kwargs):
         self.slug = self.slug.lower()
--- ./notaso/universities/migrations/0001_initial.py	(original)
+++ ./notaso/universities/migrations/0001_initial.py	(refactored)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 # Generated by Django 1.11.15 on 2018-08-19 16:53
-from __future__ import unicode_literals
+
 
 from django.db import migrations, models
 
--- ./notaso/users/migrations/0001_initial.py	(original)
+++ ./notaso/users/migrations/0001_initial.py	(refactored)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 # Generated by Django 1.11.15 on 2018-08-18 23:33
-from __future__ import unicode_literals
+
 
 from django.db import migrations, models
 
--- ./notaso/users/templatetags/users_extras.py	(original)
+++ ./notaso/users/templatetags/users_extras.py	(refactored)
@@ -1,5 +1,5 @@
 import hashlib
-import urllib
+import urllib.request, urllib.parse, urllib.error
 
 from django import template
 from django.conf import settings
@@ -11,7 +11,7 @@
 def gravatar_url(instance, email):
     size = 40
     hash = hashlib.md5(email.lower()).hexdigest()
-    params = urllib.urlencode({"d": "retro", "s": str(size)})
+    params = urllib.parse.urlencode({"d": "retro", "s": str(size)})
 
     return "{}://www.gravatar.com/avatar/{}?".format(settings.PROTOCOL, hash, params)

It's a start!

@jpadilla
Copy link
Owner

Nice! Started working on this already on #107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants