This commit is contained in:
@@ -2,7 +2,6 @@ from django.http import FileResponse, Http404
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.urls import reverse
|
||||
|
||||
from .forms import TimelapseJobCreateForm
|
||||
from .models import Camera, TimelapseJob
|
||||
from .services.cameras import get_camera_lastsnap_path, is_storage_available, list_active_cameras
|
||||
|
||||
@@ -47,6 +46,8 @@ def job_detail(request, job_id: int):
|
||||
|
||||
|
||||
def job_create(request, camera_id: int):
|
||||
from .forms import TimelapseJobCreateForm
|
||||
|
||||
camera = get_object_or_404(Camera, pk=camera_id, is_active=True)
|
||||
|
||||
if request.method == 'POST':
|
||||
@@ -59,4 +60,16 @@ def job_create(request, camera_id: int):
|
||||
else:
|
||||
form = TimelapseJobCreateForm()
|
||||
|
||||
return render(request, 'camlaps/job_create.html', {'camera': camera, 'form': form})
|
||||
sampling_choices = TimelapseJob.SamplingPreset.choices
|
||||
sampling_max = len(TimelapseJob.SAMPLING_PRESET_MINUTES) - 1
|
||||
|
||||
return render(
|
||||
request,
|
||||
'camlaps/job_create.html',
|
||||
{
|
||||
'camera': camera,
|
||||
'form': form,
|
||||
'sampling_choices': sampling_choices,
|
||||
'sampling_max': sampling_max,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user