diff --git a/src/postorius/auth/decorators.py b/src/postorius/auth/decorators.py
index ad3aa07..b71cbb7 100644
--- a/src/postorius/auth/decorators.py
+++ b/src/postorius/auth/decorators.py
@@ -15,8 +15,10 @@
#
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+
"""Postorius view decorators."""
+from __future__ import absolute_import, unicode_literals
from django.contrib.auth import authenticate, login
from django.core.exceptions import PermissionDenied
diff --git a/src/postorius/auth/utils.py b/src/postorius/auth/utils.py
index d2b7a8d..87356b3 100644
--- a/src/postorius/auth/utils.py
+++ b/src/postorius/auth/utils.py
@@ -20,6 +20,8 @@
Authentication and authorization-related utilities.
"""
+from __future__ import absolute_import, unicode_literals
+
from allauth.account.models import EmailAddress
from django.utils import six
from postorius.models import List
diff --git a/src/postorius/context_processors.py b/src/postorius/context_processors.py
index 8b5c284..035f307 100644
--- a/src/postorius/context_processors.py
+++ b/src/postorius/context_processors.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
import logging
from django.conf import settings
diff --git a/src/postorius/fieldset_forms.py b/src/postorius/fieldset_forms.py
index 2b23f3a..c02b8b8 100644
--- a/src/postorius/fieldset_forms.py
+++ b/src/postorius/fieldset_forms.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django.forms import Form
from django.utils import safestring
from django.forms.forms import BoundField
diff --git a/src/postorius/forms.py b/src/postorius/forms.py
index 3bdfc95..c324a3e 100644
--- a/src/postorius/forms.py
+++ b/src/postorius/forms.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django import forms
from django.core.validators import validate_email
from django.utils.encoding import smart_text
diff --git a/src/postorius/middleware.py b/src/postorius/middleware.py
index d55b79e..2c1f874 100644
--- a/src/postorius/middleware.py
+++ b/src/postorius/middleware.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
from postorius import utils
from postorius.models import MailmanApiError
diff --git a/src/postorius/models.py b/src/postorius/models.py
index b0ce8de..69779fa 100644
--- a/src/postorius/models.py
+++ b/src/postorius/models.py
@@ -15,6 +15,7 @@
#
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+
from __future__ import (
absolute_import, division, print_function, unicode_literals)
diff --git a/src/postorius/templatetags/membership_helpers.py b/src/postorius/templatetags/membership_helpers.py
index 3af7262..a69c517 100644
--- a/src/postorius/templatetags/membership_helpers.py
+++ b/src/postorius/templatetags/membership_helpers.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django import template
from postorius.auth.utils import user_is_in_list_roster
diff --git a/src/postorius/templatetags/nav_helpers.py b/src/postorius/templatetags/nav_helpers.py
index 211d014..84007e8 100644
--- a/src/postorius/templatetags/nav_helpers.py
+++ b/src/postorius/templatetags/nav_helpers.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django import template
diff --git a/src/postorius/tests/test_auth_decorators.py b/src/postorius/tests/test_auth_decorators.py
index 1d4e925..3db47c0 100644
--- a/src/postorius/tests/test_auth_decorators.py
+++ b/src/postorius/tests/test_auth_decorators.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from allauth.account.models import EmailAddress
from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import PermissionDenied
diff --git a/src/postorius/tests/test_forms.py b/src/postorius/tests/test_forms.py
index a5a5362..08f739f 100644
--- a/src/postorius/tests/test_forms.py
+++ b/src/postorius/tests/test_forms.py
@@ -14,6 +14,9 @@
#
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+
+from __future__ import absolute_import, unicode_literals
+
from django.test import TestCase
from postorius.forms import (ListNew, UserPreferences, DomainNew,
diff --git a/src/postorius/tests/test_urls.py b/src/postorius/tests/test_urls.py
index 444ccbb..4b8a21c 100644
--- a/src/postorius/tests/test_urls.py
+++ b/src/postorius/tests/test_urls.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django.test import TestCase
from django.core.urlresolvers import reverse, NoReverseMatch
diff --git a/src/postorius/tests/utils.py b/src/postorius/tests/utils.py
index 8d6ac46..1438227 100644
--- a/src/postorius/tests/utils.py
+++ b/src/postorius/tests/utils.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
import os
import logging
diff --git a/src/postorius/urls.py b/src/postorius/urls.py
index defecd7..d921571 100644
--- a/src/postorius/urls.py
+++ b/src/postorius/urls.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django.conf.urls import url, include
from django.contrib.auth.views import login as login_view
from django.contrib.auth.views import logout as logout_view
diff --git a/src/postorius/utils.py b/src/postorius/utils.py
index f6cc6ba..dc681dd 100644
--- a/src/postorius/utils.py
+++ b/src/postorius/utils.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
import logging
from django.shortcuts import render
diff --git a/src/postorius/views/domain.py b/src/postorius/views/domain.py
index cd78907..1d68d90 100644
--- a/src/postorius/views/domain.py
+++ b/src/postorius/views/domain.py
@@ -17,6 +17,8 @@
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
diff --git a/src/postorius/views/generic.py b/src/postorius/views/generic.py
index 148048a..8fc86de 100644
--- a/src/postorius/views/generic.py
+++ b/src/postorius/views/generic.py
@@ -17,6 +17,8 @@
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
from django.views.generic import TemplateView
from django_mailman3.lib.mailman import get_mailman_client
diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py
index f995f26..a22adbd 100644
--- a/src/postorius/views/list.py
+++ b/src/postorius/views/list.py
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
+
import csv
import email.utils
import logging
@@ -680,10 +682,12 @@
return utils.render_api_error(request)
# List settings are grouped an processed in different forms.
if request.method == 'POST':
- form = form_class(request.POST, mlist=m_list)
+ initial_data = dict(
+ (key, unicode(value)) for key, value in list_settings.items())
+ form = form_class(request.POST, mlist=m_list, initial=initial_data)
if form.is_valid():
try:
- for key in form.fields.keys():
+ for key in form.changed_data:
if key in form_class.mlist_properties:
setattr(m_list, key, form.cleaned_data[key])
else:
diff --git a/src/postorius/views/rest.py b/src/postorius/views/rest.py
index 18043e8..b074ddc 100644
--- a/src/postorius/views/rest.py
+++ b/src/postorius/views/rest.py
@@ -15,6 +15,9 @@
#
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+
+from __future__ import absolute_import, unicode_literals
+
import json
from email.Header import decode_header
diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py
index 55a6fdc..49daf94 100644
--- a/src/postorius/views/user.py
+++ b/src/postorius/views/user.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
+from __future__ import absolute_import, unicode_literals
import logging