From 42bc391e578277bb57a26094ca1d6dabd1c166b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Mon, 20 Feb 2023 21:33:15 +0100 Subject: [PATCH] Use date and datetime inputs Properly implements 4d91a76513 --- games/forms.py | 6 +++++- timetracker/settings.py | 21 +-------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/games/forms.py b/games/forms.py index 3ca0138..4a23482 100644 --- a/games/forms.py +++ b/games/forms.py @@ -9,6 +9,11 @@ custom_datetime_widget = forms.DateTimeInput( ) autofocus_input_widget = forms.TextInput(attrs={"autofocus": "autofocus"}) +custom_date_widget = forms.DateInput(attrs={"type": "date"}) +custom_datetime_widget = forms.DateTimeInput( + attrs={"type": "datetime-local"}, format="%Y-%m-%d %H:%M" +) + class SessionForm(forms.ModelForm): # purchase = forms.ModelChoiceField( @@ -82,7 +87,6 @@ class PurchaseForm(forms.ModelForm): widgets = { "date_purchased": custom_date_widget, "date_refunded": custom_date_widget, - "date_finished": custom_date_widget, } model = Purchase fields = [ diff --git a/timetracker/settings.py b/timetracker/settings.py index a668ce6..82f5aee 100644 --- a/timetracker/settings.py +++ b/timetracker/settings.py @@ -155,23 +155,4 @@ if _csrf_trusted_origins: else: CSRF_TRUSTED_ORIGINS = [] -REST_FRAMEWORK = { - "DEFAULT_PERMISSION_CLASSES": [ - "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly" - ] -} - -FRONTEND_ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", "frontend", "dist")) -CORS_ORIGIN_ALLOW_ALL = True -CORS_ALLOW_CREDENTIALS = True - -CORS_ALLOW_HEADERS = list(default_headers) + [ - "Accept-Language", - "Connection", - "Host", - "Origin", - "Referer", - "Sec-Fetch-Dest", - "Sec-Fetch-Mode", - "Sec-Fetch-Site", -] +USE_L10N = False