This commit is contained in:
Lukáš Kucharczyk 2023-11-15 19:36:22 +01:00
parent bd8d30eac1
commit c49177d63c
6 changed files with 28 additions and 26 deletions

View File

@ -1,6 +1,6 @@
from django.contrib import admin 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. # Register your models here.
admin.site.register(Game) admin.site.register(Game)

View File

@ -1,6 +1,7 @@
from django import forms from django import forms
from django.urls import reverse 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_date_widget = forms.DateInput(attrs={"type": "date"})
custom_datetime_widget = forms.DateTimeInput( custom_datetime_widget = forms.DateTimeInput(

View File

@ -1,9 +1,11 @@
from common.time import format_duration
from datetime import timedelta from datetime import timedelta
from django.db import models
from django.core.exceptions import ValidationError 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.db.models import F, Manager, Sum
from django.utils import timezone
from common.time import format_duration
class Game(models.Model): class Game(models.Model):

View File

@ -1,23 +1,19 @@
from common.time import format_duration
from common.utils import safe_division
from datetime import datetime, timedelta 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.db.models.functions import TruncDate
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render from django.shortcuts import redirect, render
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from typing import Callable, Any
from .forms import ( from common.time import format_duration
GameForm, from common.utils import safe_division
PlatformForm,
PurchaseForm, from .forms import (DeviceForm, EditionForm, GameForm, PlatformForm,
SessionForm, PurchaseForm, SessionForm)
EditionForm, from .models import Edition, Game, Platform, Purchase, Session
DeviceForm,
)
from .models import Game, Platform, Purchase, Session, Edition
def model_counts(request): def model_counts(request):

View File

@ -1,15 +1,16 @@
import django
import os import os
from django.test import TestCase
from django.urls import reverse
from datetime import datetime from datetime import datetime
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
import django
from django.test import TestCase
from django.urls import reverse
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings")
django.setup() django.setup()
from django.conf import settings 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) ZONEINFO = ZoneInfo(settings.TIME_ZONE)

View File

@ -1,14 +1,16 @@
import django
import os import os
from django.test import TestCase
from django.db import models
from datetime import datetime from datetime import datetime
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
import django
from django.db import models
from django.test import TestCase
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings")
django.setup() django.setup()
from django.conf import settings 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) ZONEINFO = ZoneInfo(settings.TIME_ZONE)