diff --git a/code_check.py b/code_check.py index 8fedadcd6..94e393083 100755 --- a/code_check.py +++ b/code_check.py @@ -47,7 +47,7 @@ def get_current_msgids(): saved_msgids = get_current_msgids() # re-extract locale files from source code - ignore_paths = ("env/*", "src/*", "fabric/*", "media/*", "sitestatic/*", "static/*", "node_modules/*") + ignore_paths = (".venv/*", "env/*", "src/*", "fabric/*", "media/*", "sitestatic/*", "static/*", "node_modules/*") ignore_args = " ".join([f'--ignore="{p}"' for p in ignore_paths]) cmd(f"python manage.py makemessages -a -e html,txt,py --no-location --no-wrap --symlinks {ignore_args}") diff --git a/ureport/admins/views.py b/ureport/admins/views.py index c84b56789..d6cffca38 100644 --- a/ureport/admins/views.py +++ b/ureport/admins/views.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.orgs.models import Org -from dash.orgs.views import OrgPermsMixin -from smartmin.views import SmartCRUDL, SmartUpdateView - from django import forms from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org +from dash.orgs.views import OrgPermsMixin +from smartmin.views import SmartCRUDL, SmartUpdateView from ureport.admins import OrgCache, refresh_caches diff --git a/ureport/api/serializers.py b/ureport/api/serializers.py index 9f41804f8..a7dbfb4d7 100644 --- a/ureport/api/serializers.py +++ b/ureport/api/serializers.py @@ -4,14 +4,14 @@ import json import six -from dash.categories.models import Category -from dash.dashblocks.models import DashBlock -from dash.orgs.models import Org -from dash.stories.models import Story from rest_framework import serializers from rest_framework.fields import SerializerMethodField from sorl.thumbnail import get_thumbnail +from dash.categories.models import Category +from dash.dashblocks.models import DashBlock +from dash.orgs.models import Org +from dash.stories.models import Story from ureport.assets.models import Image from ureport.news.models import NewsItem, Video from ureport.polls.models import Poll diff --git a/ureport/api/tests.py b/ureport/api/tests.py index 764d32d69..7c898e7af 100644 --- a/ureport/api/tests.py +++ b/ureport/api/tests.py @@ -7,10 +7,6 @@ from random import randint import six -from dash.categories.models import Category -from dash.dashblocks.models import DashBlock, DashBlockType -from dash.orgs.models import Org -from dash.stories.models import Story from mock import patch from rest_framework import status from rest_framework.test import APITestCase @@ -18,6 +14,10 @@ from django.contrib.auth.models import User from django.utils import timezone +from dash.categories.models import Category +from dash.dashblocks.models import DashBlock, DashBlockType +from dash.orgs.models import Org +from dash.stories.models import Story from ureport.api.serializers import CategoryReadSerializer, StoryReadSerializer, generate_absolute_url_from_file from ureport.contacts.models import ReportersCounter from ureport.flows.models import FlowResult diff --git a/ureport/api/views.py b/ureport/api/views.py index 065a68e0a..7dae0a838 100644 --- a/ureport/api/views.py +++ b/ureport/api/views.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.dashblocks.models import DashBlock -from dash.orgs.models import Org -from dash.stories.models import Story from rest_framework.generics import ListAPIView, RetrieveAPIView from django.db.models import Q +from dash.dashblocks.models import DashBlock +from dash.orgs.models import Org +from dash.stories.models import Story from ureport.api.serializers import ( DashblockReadSerializer, ImageReadSerializer, diff --git a/ureport/assets/models.py b/ureport/assets/models.py index 89be4003d..a185fe103 100644 --- a/ureport/assets/models.py +++ b/ureport/assets/models.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.orgs.models import Org -from smartmin.models import SmartModel - from django.db import models from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org +from smartmin.models import SmartModel + BANNER = "B" PATTERN = "P" FLAG = "F" diff --git a/ureport/assets/views.py b/ureport/assets/views.py index 9f04062c9..b24ce0f37 100644 --- a/ureport/assets/views.py +++ b/ureport/assets/views.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin -from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView - from django.db.models.functions import Lower +from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin +from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView from ureport.assets.models import Image diff --git a/ureport/backend/floip.py b/ureport/backend/floip.py index 004857d34..aca9c01bb 100644 --- a/ureport/backend/floip.py +++ b/ureport/backend/floip.py @@ -6,7 +6,6 @@ from collections import defaultdict import requests -from dash.utils.sync import BaseSyncer, SyncOutcome, sync_local_to_changes from django_redis import get_redis_connection from temba_client.v2 import TembaClient @@ -14,6 +13,7 @@ from django.core.cache import cache from django.utils import timezone +from dash.utils.sync import BaseSyncer, SyncOutcome, sync_local_to_changes from ureport.contacts.models import Contact from ureport.locations.models import Boundary from ureport.polls.models import Poll, PollQuestion, PollResponseCategory, PollResult diff --git a/ureport/backend/rapidpro.py b/ureport/backend/rapidpro.py index 1cc62d727..12362994f 100644 --- a/ureport/backend/rapidpro.py +++ b/ureport/backend/rapidpro.py @@ -10,8 +10,6 @@ from datetime import timedelta import requests -from dash.utils import is_dict_equal -from dash.utils.sync import BaseSyncer, sync_local_to_changes, sync_local_to_set from django_redis import get_redis_connection from temba_client.exceptions import TembaRateExceededError from temba_client.v2.types import Run @@ -19,6 +17,8 @@ from django.core.cache import cache from django.utils import timezone +from dash.utils import is_dict_equal +from dash.utils.sync import BaseSyncer, sync_local_to_changes, sync_local_to_set from ureport.contacts.models import Contact, ContactField from ureport.flows.models import FlowResultCategory from ureport.locations.models import Boundary diff --git a/ureport/backend/tests/test_floip.py b/ureport/backend/tests/test_floip.py index 0ff0e9699..cf28ad2b0 100644 --- a/ureport/backend/tests/test_floip.py +++ b/ureport/backend/tests/test_floip.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.categories.models import Category -from dash.test import MockClientQuery -from dash.utils.sync import SyncOutcome from mock import patch from temba_client.v2.types import Contact as TembaContact, ObjectRef +from dash.categories.models import Category +from dash.test import MockClientQuery +from dash.utils.sync import SyncOutcome from ureport.backend.floip import ContactSyncer, FLOIPBackend from ureport.contacts.models import Contact from ureport.flows.models import FlowResult, FlowResultCategory diff --git a/ureport/backend/tests/test_rapidpro.py b/ureport/backend/tests/test_rapidpro.py index fbf976eac..c8515f323 100644 --- a/ureport/backend/tests/test_rapidpro.py +++ b/ureport/backend/tests/test_rapidpro.py @@ -7,9 +7,6 @@ import logging from datetime import timedelta -from dash.categories.models import Category -from dash.test import MockClientQuery -from dash.utils.sync import SyncOutcome from mock import PropertyMock, patch from temba_client.exceptions import TembaRateExceededError from temba_client.v2.types import ( @@ -25,6 +22,9 @@ from django.test import override_settings from django.utils import timezone +from dash.categories.models import Category +from dash.test import MockClientQuery +from dash.utils.sync import SyncOutcome from ureport.backend.rapidpro import BoundarySyncer, ContactSyncer, FieldSyncer, RapidProBackend from ureport.contacts.models import Contact, ContactField from ureport.flows.models import FlowResult, FlowResultCategory diff --git a/ureport/bots/models.py b/ureport/bots/models.py index 5d3313d1a..034564b68 100644 --- a/ureport/bots/models.py +++ b/ureport/bots/models.py @@ -1,9 +1,9 @@ -from dash.orgs.models import Org -from smartmin.models import SmartModel - from django.db import models from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org +from smartmin.models import SmartModel + class Bot(SmartModel): org = models.ForeignKey( diff --git a/ureport/bots/views.py b/ureport/bots/views.py index 8c10e05d8..3727d90f5 100644 --- a/ureport/bots/views.py +++ b/ureport/bots/views.py @@ -1,10 +1,9 @@ -from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin -from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView - from django import forms from django.db.models.functions import Lower from django.utils.translation import gettext_lazy as _ +from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin +from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView from ureport.bots.models import Bot diff --git a/ureport/contacts/models.py b/ureport/contacts/models.py index 92aa40f22..ed30f9a8e 100644 --- a/ureport/contacts/models.py +++ b/ureport/contacts/models.py @@ -5,13 +5,13 @@ import time from collections import defaultdict -from dash.orgs.models import Org, OrgBackend from django_redis import get_redis_connection from django.db import connection, models from django.db.models import Count, Sum from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org, OrgBackend from ureport.utils import chunk_list CONTACT_LOCK_KEY = "lock:contact:%d:%s" diff --git a/ureport/contacts/tasks.py b/ureport/contacts/tasks.py index 32eda0955..686d0ef10 100644 --- a/ureport/contacts/tasks.py +++ b/ureport/contacts/tasks.py @@ -4,14 +4,14 @@ import time from celery.utils.log import get_task_logger -from dash.orgs.models import Org, TaskState -from dash.orgs.tasks import org_task -from dash.utils.sync import SyncOutcome from django_redis import get_redis_connection from django.core.cache import cache from django.utils import timezone +from dash.orgs.models import Org, TaskState +from dash.orgs.tasks import org_task +from dash.utils.sync import SyncOutcome from ureport.celery import app from ureport.contacts.models import Contact, ReportersCounter from ureport.stats.models import ContactActivity diff --git a/ureport/contacts/tests.py b/ureport/contacts/tests.py index 6c31dc40c..928d2d3b7 100644 --- a/ureport/contacts/tests.py +++ b/ureport/contacts/tests.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.orgs.models import TaskState -from dash.utils.sync import SyncOutcome from mock import patch +from dash.orgs.models import TaskState +from dash.utils.sync import SyncOutcome from ureport.contacts.models import Contact, ContactField, ReportersCounter from ureport.contacts.tasks import check_contacts_count_mismatch, pull_contacts, update_org_contact_count from ureport.locations.models import Boundary diff --git a/ureport/countries/models.py b/ureport/countries/models.py index 55e6a104f..0d785db5e 100644 --- a/ureport/countries/models.py +++ b/ureport/countries/models.py @@ -4,11 +4,12 @@ import regex import six from django_countries.fields import CountryField -from smartmin.models import SmartModel from django.db import models from django.utils.translation import gettext_lazy as _ +from smartmin.models import SmartModel + class CountryAlias(SmartModel): country = CountryField() diff --git a/ureport/countries/views.py b/ureport/countries/views.py index 40cc7b6c5..540e6858d 100644 --- a/ureport/countries/views.py +++ b/ureport/countries/views.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView - from django import forms +from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView + from .models import CountryAlias diff --git a/ureport/flows/models.py b/ureport/flows/models.py index fce9e24af..8af041245 100644 --- a/ureport/flows/models.py +++ b/ureport/flows/models.py @@ -1,7 +1,7 @@ -from dash.orgs.models import Org - from django.db import models +from dash.orgs.models import Org + # Create your models here. diff --git a/ureport/jobs/models.py b/ureport/jobs/models.py index 4479cdbb3..ded683580 100644 --- a/ureport/jobs/models.py +++ b/ureport/jobs/models.py @@ -5,8 +5,6 @@ import feedparser import six -from dash.orgs.models import Org -from smartmin.models import SmartModel from django.conf import settings from django.core.cache import cache @@ -14,6 +12,9 @@ from django.utils.html import strip_tags from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org +from smartmin.models import SmartModel + RSS_JOBS_FEED_CACHE_TIME = getattr(settings, "RSS_JOBS_FEED_CACHE_TIME", 60 * 60 * 6) RSS_JOBS_KEY = "jobsource:%d:%d" diff --git a/ureport/jobs/views.py b/ureport/jobs/views.py index 521affb78..df3ea850b 100644 --- a/ureport/jobs/views.py +++ b/ureport/jobs/views.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin -from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView - from django.utils.translation import gettext_lazy as _ +from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin +from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView from ureport.jobs.models import JobSource diff --git a/ureport/landingpages/migrations/0001_initial.py b/ureport/landingpages/migrations/0001_initial.py index f85226041..c621862c7 100644 --- a/ureport/landingpages/migrations/0001_initial.py +++ b/ureport/landingpages/migrations/0001_initial.py @@ -2,13 +2,13 @@ import functools -import dash.utils - import django.db.models.deletion import django.utils.timezone from django.conf import settings from django.db import migrations, models +import dash.utils + class Migration(migrations.Migration): initial = True diff --git a/ureport/landingpages/models.py b/ureport/landingpages/models.py index 82171d837..404d100d8 100644 --- a/ureport/landingpages/models.py +++ b/ureport/landingpages/models.py @@ -1,12 +1,11 @@ from functools import partial -from dash.orgs.models import Org -from dash.utils import generate_file_path -from smartmin.models import SmartModel - from django.db import models from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org +from dash.utils import generate_file_path +from smartmin.models import SmartModel from ureport.bots.models import Bot diff --git a/ureport/landingpages/views.py b/ureport/landingpages/views.py index f086e2db7..002dd8ec4 100644 --- a/ureport/landingpages/views.py +++ b/ureport/landingpages/views.py @@ -1,12 +1,11 @@ -from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin -from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView - from django import forms from django.db.models.functions import Lower from django.urls import reverse from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ +from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin +from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView from ureport.bots.models import Bot from ureport.landingpages.models import LandingPage diff --git a/ureport/locations/models.py b/ureport/locations/models.py index 6e78c8fd2..15be8c82f 100644 --- a/ureport/locations/models.py +++ b/ureport/locations/models.py @@ -3,12 +3,13 @@ import json -from dash.orgs.models import Org, OrgBackend from django_redis import get_redis_connection from django.db import models from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org, OrgBackend + BOUNDARY_LOCK_KEY = "lock:boundary:%d:%s" diff --git a/ureport/news/models.py b/ureport/news/models.py index dd1f51e44..89c4b8eed 100644 --- a/ureport/news/models.py +++ b/ureport/news/models.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.categories.models import Category -from dash.orgs.models import Org -from smartmin.models import SmartModel - from django.db import models from django.utils import formats from django.utils.translation import gettext_lazy as _ +from dash.categories.models import Category +from dash.orgs.models import Org +from smartmin.models import SmartModel + class NewsItem(SmartModel): title = models.CharField(max_length=255, help_text=_("The title for this item")) diff --git a/ureport/news/tests.py b/ureport/news/tests.py index 7b4f4c65b..ac010f90c 100644 --- a/ureport/news/tests.py +++ b/ureport/news/tests.py @@ -1,12 +1,11 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from dash.categories.fields import CategoryChoiceField -from dash.categories.models import Category - from django.urls import reverse from django.utils import formats +from dash.categories.fields import CategoryChoiceField +from dash.categories.models import Category from ureport.news.models import NewsItem, Video from ureport.tests import UreportTest diff --git a/ureport/news/views.py b/ureport/news/views.py index 51aabeb50..d19532aa0 100644 --- a/ureport/news/views.py +++ b/ureport/news/views.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals +from django import forms + from dash.categories.fields import CategoryChoiceField from dash.categories.models import Category from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView -from django import forms - from .models import NewsItem, Video diff --git a/ureport/polls/models.py b/ureport/polls/models.py index 1f2fd843f..55de63804 100644 --- a/ureport/polls/models.py +++ b/ureport/polls/models.py @@ -8,11 +8,7 @@ from datetime import timedelta import six -from dash.categories.models import Category, CategoryImage -from dash.orgs.models import Org, OrgBackend -from dash.tags.models import Tag from django_redis import get_redis_connection -from smartmin.models import SmartModel from django.conf import settings from django.contrib.auth.models import User @@ -25,6 +21,10 @@ from django.utils.text import slugify from django.utils.translation import gettext_lazy as _ +from dash.categories.models import Category, CategoryImage +from dash.orgs.models import Org, OrgBackend +from dash.tags.models import Tag +from smartmin.models import SmartModel from ureport.flows.models import FlowResult, FlowResultCategory logger = logging.getLogger(__name__) diff --git a/ureport/polls/tasks.py b/ureport/polls/tasks.py index 605c57b1e..44488db71 100644 --- a/ureport/polls/tasks.py +++ b/ureport/polls/tasks.py @@ -5,14 +5,14 @@ import time from datetime import timedelta -from dash.orgs.models import Org -from dash.orgs.tasks import org_task from django_redis import get_redis_connection from temba_client.exceptions import TembaRateExceededError from django.core.cache import cache from django.utils import timezone +from dash.orgs.models import Org +from dash.orgs.tasks import org_task from ureport.celery import app from ureport.utils import ( fetch_flows, diff --git a/ureport/polls/tests.py b/ureport/polls/tests.py index b44c24d7d..8efbbc82b 100644 --- a/ureport/polls/tests.py +++ b/ureport/polls/tests.py @@ -6,10 +6,6 @@ from datetime import date, datetime, timedelta import six -from dash.categories.fields import CategoryChoiceField -from dash.categories.models import Category, CategoryImage -from dash.orgs.models import TaskState -from dash.tags.models import Tag from mock import Mock, patch from temba_client.exceptions import TembaRateExceededError @@ -22,6 +18,10 @@ from django.urls import reverse from django.utils import timezone +from dash.categories.fields import CategoryChoiceField +from dash.categories.models import Category, CategoryImage +from dash.orgs.models import TaskState +from dash.tags.models import Tag from ureport.flows.models import FlowResultCategory from ureport.locations.models import Boundary from ureport.polls.models import Poll, PollImage, PollQuestion, PollResponseCategory, PollResult diff --git a/ureport/polls/views.py b/ureport/polls/views.py index e28f4fca6..4792fdb93 100644 --- a/ureport/polls/views.py +++ b/ureport/polls/views.py @@ -5,13 +5,7 @@ import re from datetime import timedelta -from dash.categories.fields import CategoryChoiceField -from dash.categories.models import Category, CategoryImage -from dash.orgs.models import OrgBackend -from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin -from dash.tags.models import Tag from django_redis import get_redis_connection -from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView from django import forms from django.core.cache import cache @@ -26,6 +20,12 @@ from django.utils.timesince import timesince from django.utils.translation import gettext_lazy as _ +from dash.categories.fields import CategoryChoiceField +from dash.categories.models import Category, CategoryImage +from dash.orgs.models import OrgBackend +from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin +from dash.tags.models import Tag +from smartmin.views import SmartCreateView, SmartCRUDL, SmartListView, SmartUpdateView from ureport.utils import json_date_to_datetime from .models import Poll, PollImage, PollQuestion, PollResponseCategory diff --git a/ureport/public/tests.py b/ureport/public/tests.py index d2b714782..1d8b65f1f 100644 --- a/ureport/public/tests.py +++ b/ureport/public/tests.py @@ -7,15 +7,15 @@ from urllib.parse import quote import mock -from dash.categories.models import Category -from dash.dashblocks.models import DashBlock, DashBlockType -from dash.orgs.models import TaskState -from dash.stories.models import Story from django.test import override_settings from django.urls import reverse from django.utils import timezone +from dash.categories.models import Category +from dash.dashblocks.models import DashBlock, DashBlockType +from dash.orgs.models import TaskState +from dash.stories.models import Story from ureport.assets.models import Image from ureport.countries.models import CountryAlias from ureport.news.models import NewsItem diff --git a/ureport/public/views.py b/ureport/public/views.py index 435ea5460..f6df82b43 100644 --- a/ureport/public/views.py +++ b/ureport/public/views.py @@ -10,13 +10,7 @@ import pycountry import six -from dash.categories.models import Category -from dash.dashblocks.models import DashBlock, DashBlockType -from dash.orgs.models import Org, TaskState -from dash.orgs.views import OrgObjPermsMixin -from dash.stories.models import Story, StoryImage from django_redis import get_redis_connection -from smartmin.views import SmartReadView, SmartTemplateView from django.conf import settings from django.core.cache import cache @@ -30,6 +24,12 @@ from django.views.decorators.csrf import csrf_exempt from django.views.generic.base import RedirectView +from dash.categories.models import Category +from dash.dashblocks.models import DashBlock, DashBlockType +from dash.orgs.models import Org, TaskState +from dash.orgs.views import OrgObjPermsMixin +from dash.stories.models import Story, StoryImage +from smartmin.views import SmartReadView, SmartTemplateView from ureport.assets.models import Image from ureport.bots.models import Bot from ureport.countries.models import CountryAlias diff --git a/ureport/stats/models.py b/ureport/stats/models.py index 46328a9c1..05a428ef0 100644 --- a/ureport/stats/models.py +++ b/ureport/stats/models.py @@ -3,8 +3,6 @@ from collections import defaultdict from datetime import timedelta -from dash.orgs.models import Org - from django.core.cache import cache from django.db import connection, models from django.db.models import IntegerField, JSONField, Q, Sum @@ -12,6 +10,7 @@ from django.utils import timezone, translation from django.utils.translation import gettext_lazy as _ +from dash.orgs.models import Org from ureport.flows.models import FlowResult, FlowResultCategory from ureport.locations.models import Boundary from ureport.polls.models import Poll, PollQuestion, PollResponseCategory diff --git a/ureport/stats/tasks.py b/ureport/stats/tasks.py index a4114a187..5bfb510e3 100644 --- a/ureport/stats/tasks.py +++ b/ureport/stats/tasks.py @@ -2,11 +2,10 @@ import time from datetime import timedelta -from dash.orgs.models import Org -from dash.orgs.tasks import org_task - from django.utils import timezone +from dash.orgs.models import Org +from dash.orgs.tasks import org_task from ureport.celery import app from ureport.utils import chunk_list diff --git a/ureport/tests.py b/ureport/tests.py index 42a4dc9ad..da63481a6 100644 --- a/ureport/tests.py +++ b/ureport/tests.py @@ -5,12 +5,7 @@ import uuid import zoneinfo -from dash.orgs.middleware import SetOrgMiddleware -from dash.orgs.models import Org -from dash.test import DashTest -from dash.utils import random_string from mock import Mock, patch -from smartmin.tests import SmartminTest from temba_client.v2 import TembaClient from temba_client.v2.types import ( Contact as TembaContact, @@ -29,6 +24,11 @@ from django.utils import timezone from django.utils.encoding import force_str +from dash.orgs.middleware import SetOrgMiddleware +from dash.orgs.models import Org +from dash.test import DashTest +from dash.utils import random_string +from smartmin.tests import SmartminTest from ureport.backend.rapidpro import RapidProBackend from ureport.flows.models import FlowResult, FlowResultCategory from ureport.jobs.models import JobSource diff --git a/ureport/utils/__init__.py b/ureport/utils/__init__.py index c10f40b0c..0ef4ca0aa 100644 --- a/ureport/utils/__init__.py +++ b/ureport/utils/__init__.py @@ -11,8 +11,6 @@ import iso8601 import six -from dash.orgs.models import Org -from dash.utils import datetime_to_ms from sentry_sdk import capture_exception from django.conf import settings @@ -20,6 +18,8 @@ from django.db.models import Sum from django.utils import timezone, translation +from dash.orgs.models import Org +from dash.utils import datetime_to_ms from ureport.assets.models import LOGO, Image from ureport.locations.models import Boundary from ureport.polls.models import Poll, PollResult diff --git a/ureport/utils/tests.py b/ureport/utils/tests.py index 459a4e259..43099773d 100644 --- a/ureport/utils/tests.py +++ b/ureport/utils/tests.py @@ -7,14 +7,14 @@ import mock import redis -from dash.categories.models import Category -from dash.test import MockClientQuery, MockResponse from mock import patch from temba_client.v2 import Flow from django.conf import settings from django.utils import timezone +from dash.categories.models import Category +from dash.test import MockClientQuery, MockResponse from ureport.contacts.models import ReportersCounter from ureport.locations.models import Boundary from ureport.polls.models import CACHE_ORG_FLOWS_KEY, UREPORT_ASYNC_FETCHED_DATA_CACHE_TIME, Poll