подправил логику работы проги
All checks were successful
Deploy timelaps / deploy (push) Successful in 5s
All checks were successful
Deploy timelaps / deploy (push) Successful in 5s
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from django import forms
|
||||
from django.utils import timezone
|
||||
|
||||
from .models import TimelapseJob
|
||||
|
||||
|
||||
class TimelapseJobCreateForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if not self.is_bound:
|
||||
today = timezone.localdate()
|
||||
self.initial.setdefault('date_to', today)
|
||||
self.initial.setdefault('date_from', today - timedelta(days=7))
|
||||
|
||||
class Meta:
|
||||
model = TimelapseJob
|
||||
fields = (
|
||||
|
||||
Reference in New Issue
Block a user