[damned-lies] Update project to Django 1.10



commit 08c0b70248b895489c4bb4acec79ba9fce4cdeb9
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Mar 25 15:38:08 2017 +0100

    Update project to Django 1.10

 damnedlies/settings.py |    4 ++--
 damnedlies/urls.py     |    2 +-
 people/views.py        |    2 +-
 requirements.txt       |    2 +-
 stats/views.py         |    8 ++++----
 teams/models.py        |    2 +-
 vertimus/forms.py      |    6 +++---
 vertimus/views.py      |    2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/damnedlies/settings.py b/damnedlies/settings.py
index 6edf659..db11e2c 100644
--- a/damnedlies/settings.py
+++ b/damnedlies/settings.py
@@ -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
 
diff --git a/damnedlies/urls.py b/damnedlies/urls.py
index 552760a..6e54a4c 100644
--- a/damnedlies/urls.py
+++ b/damnedlies/urls.py
@@ -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')),
 ]
 
diff --git a/people/views.py b/people/views.py
index 7e92db2..94b7ef9 100644
--- a/people/views.py
+++ b/people/views.py
@@ -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
diff --git a/requirements.txt b/requirements.txt
index 5e60ebf..3b28c28 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-django>=1.8
+django>=1.10
 django-debug-toolbar
 markdown
 pyicu
diff --git a/stats/views.py b/stats/views.py
index 95904cc..324b719 100644
--- a/stats/views.py
+++ b/stats/views.py
@@ -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
diff --git a/teams/models.py b/teams/models.py
index c6badf4..5e7804d 100644
--- a/teams/models.py
+++ b/teams/models.py
@@ -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):
diff --git a/vertimus/forms.py b/vertimus/forms.py
index ade8962..ebcfbd6 100644
--- a/vertimus/forms.py
+++ b/vertimus/forms.py
@@ -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():
diff --git a/vertimus/views.py b/vertimus/views.py
index c84a53a..7d510a3 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]