Commit c3223e69 authored by André Anjos's avatar André Anjos 💬

[many] Fixes for Django 1.9.x compatibility

parent a03bc6a6
......@@ -27,8 +27,6 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from actstream import registry
class AccountsConfig(AppConfig):
......@@ -36,5 +34,8 @@ class AccountsConfig(AppConfig):
verbose_name = _('Accounts')
def ready(self):
super(AccountsConfig, self).ready()
from django.contrib.auth.models import User
from actstream import registry
registry.register(User)
from .signals import setup_user
......@@ -28,8 +28,6 @@
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^settings/$',
views.account_settings,
name='settings')
)
urlpatterns = [
url(r'^settings/$', views.account_settings, name='settings'),
]
......@@ -27,7 +27,6 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class AlgorithmsConfig(CommonAppConfig):
name = 'beat.web.algorithms'
......@@ -39,4 +38,5 @@ class AlgorithmsConfig(CommonAppConfig):
from .signals import (create_endpoints, delete_endpoints,
auto_delete_file_on_delete, auto_delete_file_on_change)
from actstream import registry
registry.register(self.get_model('Algorithm'))
......@@ -27,7 +27,6 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class AttestationsConfig(CommonAppConfig):
name = 'beat.web.attestations'
......@@ -35,7 +34,6 @@ class AttestationsConfig(CommonAppConfig):
def ready(self):
super(AttestationsConfig, self).ready()
from .signals.handlers import on_unlocked
from actstream import registry
registry.register(self.get_model('Attestation'))
......@@ -29,16 +29,8 @@ from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework import permissions
from ..utils.api import send_email_to_administrators
from ..utils import scheduler as scheduler_api
from .models import Environment
import simplejson as json
#----------------------------------------------------------
@api_view(['GET'])
@permission_classes([permissions.AllowAny])
......
......@@ -27,7 +27,6 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class DataFormatsConfig(CommonAppConfig):
......@@ -35,9 +34,7 @@ class DataFormatsConfig(CommonAppConfig):
verbose_name = _('Data Formats')
def ready(self):
super(DataFormatsConfig, self).ready()
from .signals import (on_team_delete,
auto_delete_file_on_delete, auto_delete_file_on_change)
super(DataFormatsConfig, self).ready()
from .signals import on_team_delete, auto_delete_file_on_delete, auto_delete_file_on_change
from actstream import registry
registry.register(self.get_model('DataFormat'))
......@@ -27,7 +27,8 @@
import re
import uuid
import simplejson as json
import simplejson
from django.conf import settings
from django.shortcuts import get_object_or_404
......@@ -64,7 +65,6 @@ from ..algorithms.models import Algorithm
from ..toolchains.models import Toolchain
from ..utils.api import send_email_to_administrators
from ..utils import scheduler
#----------------------------------------------------------
......@@ -214,7 +214,7 @@ class ListCreateExperimentsView(ListCreateContributionView):
else:
declaration_string = data['declaration']
try:
declaration = json.loads(declaration_string)
declaration = simplejson.loads(declaration_string)
except:
return BadRequestResponse('Invalid declaration data')
......@@ -388,11 +388,11 @@ class RetrieveUpdateDestroyExperimentView(RetrieveUpdateDestroyContributionView)
if isinstance(data['declaration'], dict):
declaration = data['declaration']
declaration_string = json.dumps(declaration, indent=4)
declaration_string = simplejson.dumps(declaration, indent=4)
else:
declaration_string = data['declaration']
try:
declaration = json.loads(declaration_string)
declaration = simplejson.loads(declaration_string)
except:
raise serializers.ValidationError({'declaration' :'Invalid declaration data'})
......@@ -403,7 +403,7 @@ class RetrieveUpdateDestroyExperimentView(RetrieveUpdateDestroyContributionView)
short_description = declaration['description']
elif short_description is not None:
declaration['description'] = short_description
declaration_string = json.dumps(declaration, indent=4)
declaration_string = simplejson.dumps(declaration, indent=4)
else:
declaration = None
......
......@@ -27,15 +27,13 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class ExperimentsConfig(CommonAppConfig):
name = 'beat.web.experiments'
verbose_name = _('Experiments')
def ready(self):
super(ExperimentsConfig, self).ready()
super(ExperimentsConfig, self).ready()
from .signals import on_team_delete
from actstream import registry
registry.register(self.get_model('Experiment'))
......@@ -27,15 +27,13 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class LibrariesConfig(CommonAppConfig):
name = 'beat.web.libraries'
verbose_name = _('Libraries')
def ready(self):
super(LibrariesConfig, self).ready()
super(LibrariesConfig, self).ready()
from .signals import auto_delete_file_on_delete, auto_delete_file_on_change
from actstream import registry
registry.register(self.get_model('Library'))
......@@ -27,7 +27,6 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class PlottersConfig(CommonAppConfig):
name = 'beat.web.plotters'
......@@ -35,4 +34,5 @@ class PlottersConfig(CommonAppConfig):
def ready(self):
super(PlottersConfig, self).ready()
from actstream import registry
registry.register(self.get_model('Plotter'))
......@@ -31,7 +31,7 @@ from . import views
urlpatterns = [
url(
r'^/$',
r'^$',
views.list_plotters,
name='list',
),
......
......@@ -27,7 +27,6 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class SearchConfig(CommonAppConfig):
name = 'beat.web.search'
......@@ -35,4 +34,5 @@ class SearchConfig(CommonAppConfig):
def ready(self):
super(SearchConfig, self).ready()
from actstream import registry
registry.register(self.get_model('Search'))
......@@ -27,15 +27,13 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class TeamConfig(CommonAppConfig):
name = 'beat.web.team'
verbose_name = _('Team')
def ready(self):
super(TeamConfig, self).ready()
super(TeamConfig, self).ready()
from .signals.handlers import on_added_to_team
from actstream import registry
registry.register(self.get_model('Team'))
......@@ -27,7 +27,6 @@
from ..common.apps import CommonAppConfig
from django.utils.translation import ugettext_lazy as _
from actstream import registry
class ToolchainsConfig(CommonAppConfig):
......@@ -37,8 +36,7 @@ class ToolchainsConfig(CommonAppConfig):
def ready(self):
super(ToolchainsConfig, self).ready()
from .signals import auto_delete_file_on_delete, auto_delete_file_on_change
from actstream import registry
registry.register(self.get_model('Toolchain'))
......@@ -28,6 +28,7 @@
from django.conf.urls import url
from django.conf import settings
from django.views.generic.base import TemplateView
from django.contrib.auth.views import logout
from . import views
......@@ -53,7 +54,7 @@ urlpatterns = [
),
url(r'^logout/$',
'django.contrib.auth.views.logout',
logout,
{'next_page': 'index'},
name='logout',
),
......
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