Commit 08c0b702 authored by Claude Paroz's avatar Claude Paroz

Update project to Django 1.10

parent 6248d42e
......@@ -118,7 +118,7 @@ TEMPLATES = [
},
]
MIDDLEWARE_CLASSES = (
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
......@@ -127,7 +127,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
]
ATOMIC_REQUESTS = True
......
......@@ -53,7 +53,7 @@ urlpatterns = [
url(r'^languages/', include('languages.urls')),
url(r'^vertimus/', include('vertimus.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
url(r'^rss/', include('feeds.urls')),
]
......
......@@ -41,7 +41,7 @@ class PersonDetailView(DetailView):
context.update({
'pageSection': "teams",
'all_languages': all_languages,
'on_own_page': self.request.user.is_authenticated() and self.object.username == self.request.user.username,
'on_own_page': self.request.user.is_authenticated and self.object.username == self.request.user.username,
'states': [(s, s.stats) for s in states],
})
return context
......
......@@ -32,7 +32,7 @@ def modules(request, format='html'):
def module(request, module_name):
mod = get_object_or_404(Module, name=module_name)
branches = sorted(mod.branch_set.all())
if request.user.is_authenticated():
if request.user.is_authenticated:
person = Person.get_by_user(request.user)
langs = person.get_languages()
for branch in branches[:2]:
......@@ -56,7 +56,7 @@ def module_branch(request, module_name, branch_name):
""" This view is used to dynamically load a specific branch stats (jquery.load) """
mod = get_object_or_404(Module, name=module_name)
branch = get_object_or_404(mod.branch_set, name=branch_name)
if request.user.is_authenticated():
if request.user.is_authenticated:
person = Person.get_by_user(request.user)
langs = person.get_languages()
# Cache the branch stats with user langs included
......@@ -213,7 +213,7 @@ def dynamic_po(request, module_name, domain, branch_name, filename):
'pack': module_name,
'year': date.today().year
}
if request.user.is_authenticated():
if request.user.is_authenticated:
person = Person.get_by_user(request.user)
dyn_content += "# %(name)s <%(email)s>, %(year)s.\n#\n" % {
'name' : person.name,
......@@ -301,7 +301,7 @@ def compare_by_releases(request, dtype, rels_to_compare):
# ********** Utility function **********
def can_refresh_branch(user):
""" Return True if user is authorized to force statistics refresh """
if not user.is_authenticated():
if not user.is_authenticated:
return False
if user.has_perm('stats.change_module'):
return True
......
......@@ -92,7 +92,7 @@ class Team(models.Model):
""" Return True if user is allowed to edit this team
user is a User (from request.user), not a Person
"""
return (user.is_authenticated() and
return (user.is_authenticated and
user.username in [p.username for p in self.get_coordinators()])
def fill_role(self, role, person):
......
......@@ -12,10 +12,10 @@ from stats.utils import po_file_stats
class ActionWidget(forms.Select):
""" Custom widget to disable the separator option (containing "--------") """
def render_options(self, choices, selected_choices):
def render_options(self, selected_choices):
if selected_choices == ['']:
selected_choices = []
options = super().render_options(choices, selected_choices)
options = super().render_options(selected_choices)
options = options.replace('<option value="">--------</option>',
'<option disabled="disabled">--------</option>')
return options
......@@ -23,7 +23,7 @@ class ActionWidget(forms.Select):
class AuthorWidget(forms.Select):
""" Custom widget to disable people without full name or email """
def render_options(self, choices, selected_choices):
def render_options(self, selected_choices):
output = ["<option value=\"\">--------</option>"]
field = self.choices.field
for pers in field.queryset.all():
......
......@@ -84,7 +84,7 @@ def vertimus(request, branch, domain, language, stats=None, level="0"):
grandparent_level = level + 1 if sequence_grandparent else None
action_form = None
if request.user.is_authenticated() and level == 0:
if request.user.is_authenticated and level == 0:
# Only authenticated user can act on the translation and it's not
# possible to edit an archived workflow
person = request.user.person
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment