Closed rnegron closed 6 years ago
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!
Nice! Started working on this already on #107
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:
It's a start!