The struggle with moving to Python 3 in Django

Well this is a bit of a click bait title which I didn’t mean for, however I will outline some of my struggles of porting from Python 2.7 to Python 3.6+.

It is the little changes that seems to hurt. Last night I found the following bug – What could it mean? My following process weeded out the exact issue (after each test I returned to the original code);

  1. Remove ALL context – worked
  2. Set template onto BLANK – worked
  3. Remove bottom part of the “New Campus” template – did not work
  4. Remove top part of the “New Campus” template – worked
  5. Decided the issue was with one of the fields. Removed all fields and start placing them back one at a time

This processes led me to find out that my special widget was producing this issue. So I went to the “” and search for the “render(” function. It found them.

class RegionSelect(forms.Select):
    def render(self, name, value, attrs=None, choices=()):

The code above works in Python2.7, however there was a slight change. This code has to now be

class RegionSelect(forms.Select):
    def _render(self, name, value, attrs=None, choices=()):

A simple _ was causing a massive critical issue.


Alpha Development-0.16.0 Status

The bug testing and fixing of 0.16.0 is still going ahead rather well. We currently have found 25 initial bugs. We want to make sure that there are NO critical bugs when we release 0.16.0 and then fix up the remaining bugs in later releases.

At the same time we are also fixing up our documentation to represent the change from Python2.7 to Python3.6+. This will include the pictures on Github and also our Confluence site.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.