from django.contrib import admin
 
-from models import *
+from .models import *
 
 
 class CommitterAdmin(admin.ModelAdmin):
 
 import json
 
 from pgcommitfest.auth import user_search
-from models import CommitFest, Patch, MailThread, MailThreadAttachment
-from models import MailThreadAnnotation, PatchHistory
+from .models import CommitFest, Patch, MailThread, MailThreadAttachment
+from .models import MailThreadAnnotation, PatchHistory
 
 
 class HttpResponseServiceUnavailable(HttpResponse):
         resp = HttpResponse(content_type='application/json')
         json.dump(_ajax_map[command](request), resp)
         return resp
-    except Http503, e:
+    except Http503 as e:
         return HttpResponseServiceUnavailable(e, content_type='text/plain')
 
 
 from selectable.forms.widgets import AutoCompleteSelectMultipleWidget
 
-from models import Patch, MailThread, PatchOnCommitFest
-from lookups import UserLookup
-from widgets import ThreadPickWidget
-from ajax import _archivesAPI
+from .models import Patch, MailThread, PatchOnCommitFest
+from .lookups import UserLookup
+from .widgets import ThreadPickWidget
+from .ajax import _archivesAPI
 
 
 class CommitFestFilterForm(forms.Form):
 
 from django.db import transaction
 from django.conf import settings
 
-from StringIO import StringIO
+from io import StringIO
 
 from pgcommitfest.commitfest.models import PendingNotification
 from pgcommitfest.userprofile.models import UserProfile
 
 
 from datetime import datetime
 
-from util import DiffableModel
+from .util import DiffableModel
 
 from pgcommitfest.userprofile.models import UserProfile
 
 
 from django.contrib.auth.decorators import login_required
 from django.db import connection
 
-from models import CommitFest
+from .models import CommitFest
 
 
 @login_required
 
 from pgcommitfest.mailqueue.util import send_mail, send_simple_mail
 from pgcommitfest.userprofile.util import UserWrapper
 
-from models import CommitFest, Patch, PatchOnCommitFest, PatchHistory, Committer
-from models import MailThread
-from forms import PatchForm, NewPatchForm, CommentForm, CommitFestFilterForm
-from forms import BulkEmailForm
-from ajax import doAttachThread, refresh_single_thread
-from feeds import ActivityFeed
+from .models import CommitFest, Patch, PatchOnCommitFest, PatchHistory, Committer
+from .models import MailThread
+from .forms import PatchForm, NewPatchForm, CommentForm, CommitFestFilterForm
+from .forms import BulkEmailForm
+from .ajax import doAttachThread, refresh_single_thread
+from .feeds import ActivityFeed
 
 
 def home(request):
     if request.method == 'POST':
         try:
             form = CommentForm(patch, poc, is_review, data=request.POST)
-        except Exception, e:
+        except Exception as e:
             messages.add_message(request, messages.ERROR, "Failed to build list of response options from the archives: %s" % e)
             return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))
 
     else:
         try:
             form = CommentForm(patch, poc, is_review)
-        except Exception, e:
+        except Exception as e:
             messages.add_message(request, messages.ERROR, "Failed to build list of response options from the archives: %s" % e)
             return HttpResponseRedirect('/%s/%s/' % (cf.id, patch.id))
 
         try:
             t = MailThread.objects.get(messageid=m)
             refresh_single_thread(t)
-        except Exception, e:
+        except Exception as e:
             # Just ignore it, we'll check again later
             pass
 
 
 from django.contrib import admin
 
-from models import QueuedMail
+from .models import QueuedMail
 
 admin.site.register(QueuedMail)
 
 from email.mime.text import MIMEText
 from email.mime.multipart import MIMEMultipart
 from email.mime.nonmultipart import MIMENonMultipart
-from email.Utils import formatdate
+from email.utils import formatdate
 from email import encoders
 
-from models import QueuedMail
+from .models import QueuedMail
 
 
 def send_simple_mail(sender, receiver, subject, msgtxt, sending_username, attachments=None):
 
 
 # Load local settings overrides
 try:
-    from local_settings import *
+    from .local_settings import *
 except ImportError:
     pass
 
 from django.contrib import admin
 
-from models import UserProfile
+from .models import UserProfile
 
 
 class UserProfileAdmin(admin.ModelAdmin):
 
 from django import forms
 from django.contrib.auth.models import User
 
-from models import UserProfile, UserExtraEmail
+from .models import UserProfile, UserExtraEmail
 
 
 class UserProfileForm(forms.ModelForm):
 
 from email.utils import formataddr
 from email.header import Header
 
-from models import UserProfile
+from .models import UserProfile
 
 
 def generate_random_token():
 
 
 from pgcommitfest.mailqueue.util import send_template_mail
 
-from models import UserProfile, UserExtraEmail
-from forms import UserProfileForm, MailForm
-from util import generate_random_token
+from .models import UserProfile, UserExtraEmail
+from .forms import UserProfileForm, MailForm
+from .util import generate_random_token
 
 
 @login_required