From af85607ada9aaffcbe5e84a50b9c812416314c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 15 Nov 2023 19:36:22 +0100 Subject: [PATCH] isort --- games/admin.py | 2 +- games/forms.py | 3 ++- games/models.py | 8 +++++--- games/views.py | 22 +++++++++------------- tests/test_paths_return_200.py | 9 +++++---- tests/test_session_formatting.py | 10 ++++++---- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/games/admin.py b/games/admin.py index 5b3ae8a..9d54a5b 100644 --- a/games/admin.py +++ b/games/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from games.models import Game, Platform, Purchase, Session, Edition, Device +from games.models import Device, Edition, Game, Platform, Purchase, Session # Register your models here. admin.site.register(Game) diff --git a/games/forms.py b/games/forms.py index a5e4384..40d01c1 100644 --- a/games/forms.py +++ b/games/forms.py @@ -1,6 +1,7 @@ from django import forms from django.urls import reverse -from games.models import Game, Platform, Purchase, Session, Edition, Device + +from games.models import Device, Edition, Game, Platform, Purchase, Session custom_date_widget = forms.DateInput(attrs={"type": "date"}) custom_datetime_widget = forms.DateTimeInput( diff --git a/games/models.py b/games/models.py index 02412de..18d3c67 100644 --- a/games/models.py +++ b/games/models.py @@ -1,9 +1,11 @@ -from common.time import format_duration from datetime import timedelta -from django.db import models + from django.core.exceptions import ValidationError -from django.utils import timezone +from django.db import models from django.db.models import F, Manager, Sum +from django.utils import timezone + +from common.time import format_duration class Game(models.Model): diff --git a/games/views.py b/games/views.py index 6b348fd..89ebe71 100644 --- a/games/views.py +++ b/games/views.py @@ -1,23 +1,19 @@ -from common.time import format_duration -from common.utils import safe_division from datetime import datetime, timedelta -from django.db.models import Sum, F, Count, Prefetch +from typing import Any, Callable + +from django.db.models import Count, F, Prefetch, Sum from django.db.models.functions import TruncDate from django.http import HttpRequest, HttpResponse, HttpResponseRedirect from django.shortcuts import redirect, render from django.urls import reverse from django.utils import timezone -from typing import Callable, Any -from .forms import ( - GameForm, - PlatformForm, - PurchaseForm, - SessionForm, - EditionForm, - DeviceForm, -) -from .models import Game, Platform, Purchase, Session, Edition +from common.time import format_duration +from common.utils import safe_division + +from .forms import (DeviceForm, EditionForm, GameForm, PlatformForm, + PurchaseForm, SessionForm) +from .models import Edition, Game, Platform, Purchase, Session def model_counts(request): diff --git a/tests/test_paths_return_200.py b/tests/test_paths_return_200.py index c126bfb..08bfd53 100644 --- a/tests/test_paths_return_200.py +++ b/tests/test_paths_return_200.py @@ -1,15 +1,16 @@ -import django import os -from django.test import TestCase -from django.urls import reverse from datetime import datetime from zoneinfo import ZoneInfo +import django +from django.test import TestCase +from django.urls import reverse + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings") django.setup() from django.conf import settings -from games.models import Game, Edition, Purchase, Session, Platform +from games.models import Edition, Game, Platform, Purchase, Session ZONEINFO = ZoneInfo(settings.TIME_ZONE) diff --git a/tests/test_session_formatting.py b/tests/test_session_formatting.py index f3b3a5c..4bc345e 100644 --- a/tests/test_session_formatting.py +++ b/tests/test_session_formatting.py @@ -1,14 +1,16 @@ -import django import os -from django.test import TestCase -from django.db import models from datetime import datetime from zoneinfo import ZoneInfo +import django +from django.db import models +from django.test import TestCase + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings") django.setup() from django.conf import settings -from games.models import Game, Edition, Purchase, Session + +from games.models import Edition, Game, Purchase, Session ZONEINFO = ZoneInfo(settings.TIME_ZONE)