Organize imports
Remove unused imports and organize misordered imports.
Issue: HIC-170
Change-Id: I0cb2875a6e4c0a1c4a60740c4161aa2445f4317b
diff --git a/crashreport_stats/migrations/0001_initial.py b/crashreport_stats/migrations/0001_initial.py
index d332743..7a29351 100644
--- a/crashreport_stats/migrations/0001_initial.py
+++ b/crashreport_stats/migrations/0001_initial.py
@@ -6,9 +6,6 @@
from django.db import migrations, models
import django.db.models.deletion
-from django.db import connection
-from datetime import date, timedelta
-
class Migration(migrations.Migration):
"""Set up the initial database."""
diff --git a/crashreport_stats/migrations/0002_version_and_versiondaily_with_defaults.py b/crashreport_stats/migrations/0002_version_and_versiondaily_with_defaults.py
index aa14152..8649828 100644
--- a/crashreport_stats/migrations/0002_version_and_versiondaily_with_defaults.py
+++ b/crashreport_stats/migrations/0002_version_and_versiondaily_with_defaults.py
@@ -5,7 +5,6 @@
from __future__ import unicode_literals
from django.db import migrations, models
-import django.db.models.deletion
class Migration(migrations.Migration):
diff --git a/crashreport_stats/templatetags/crashreport_stats_tags.py b/crashreport_stats/templatetags/crashreport_stats_tags.py
index 8e6f31a..452be17 100644
--- a/crashreport_stats/templatetags/crashreport_stats_tags.py
+++ b/crashreport_stats/templatetags/crashreport_stats_tags.py
@@ -1,7 +1,6 @@
"""Django template tags for crashreport statistics."""
from django import template
-from django.template import loader
register = template.Library()
diff --git a/crashreport_stats/views.py b/crashreport_stats/views.py
index 1cc19c9..8586e7d 100644
--- a/crashreport_stats/views.py
+++ b/crashreport_stats/views.py
@@ -1,18 +1,14 @@
"""Views for the Hiccup statistics."""
-from crashreports.models import *
from django.http import HttpResponse, Http404, HttpResponseRedirect
-from django.shortcuts import render
-from django.shortcuts import render_to_response
from django.template import loader
-from itertools import chain
-from django.db import connection
-from crashreport_stats import raw_querys
from django.contrib.auth.decorators import user_passes_test
from django import forms
from django.contrib import messages
from django.urls import reverse
+from crashreports.models import Device
+
def is_fairphone_staff(user):
"""Check if the user is part of the FairphoneSoftwareTeam group."""
diff --git a/crashreports/models.py b/crashreports/models.py
index 45c9da6..ccdbc5b 100644
--- a/crashreports/models.py
+++ b/crashreports/models.py
@@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
"""Models for devices, heartbeats, crashreports and log files."""
-from django.db import models
-from django.db import transaction
+import uuid
+from django.db import models, transaction
from django.contrib.auth.models import User
from taggit.managers import TaggableManager
-import uuid
-
class Device(models.Model):
"""A device representing a phone that has been registered on Hiccup."""
diff --git a/crashreports/permissions.py b/crashreports/permissions.py
index 60adee0..e130cbf 100644
--- a/crashreports/permissions.py
+++ b/crashreports/permissions.py
@@ -1,7 +1,7 @@
"""Authorization permission classes for accessing the API."""
-from crashreports.models import Device
from rest_framework.permissions import BasePermission
+from crashreports.models import Device
def user_owns_uuid(user, uuid):
diff --git a/hiccup/settings.py b/hiccup/settings.py
index 07e2415..4d46b4a 100644
--- a/hiccup/settings.py
+++ b/hiccup/settings.py
@@ -205,6 +205,6 @@
SWAGGER_SETTINGS = {"DEFAULT_INFO": "hiccup.urls.api_info"}
try:
- from local_settings import * # noqa: F403, F401
+ from local_settings import * # noqa: F403,F401 pylint: disable=W0401,W0614
except ImportError as e:
pass
diff --git a/hiccup/wsgi.py b/hiccup/wsgi.py
index 9b53dae..a193324 100644
--- a/hiccup/wsgi.py
+++ b/hiccup/wsgi.py
@@ -7,8 +7,8 @@
import os
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hiccup.settings")
-
from django.core.wsgi import get_wsgi_application
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hiccup.settings")
+
application = get_wsgi_application()