Coverage for django_napse/simulations/models/datasets/managers/dataset.py: 100%
10 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
1from datetime import datetime
3from django.db import models
6class DataSetManager(models.Manager):
7 def create(self, controller, start_date: datetime, end_date: datetime):
8 try:
9 dataset = self.model.objects.get(controller=controller)
10 except self.model.DoesNotExist:
11 dataset = self.model(
12 controller=controller,
13 )
14 dataset.save()
15 return dataset.controller.download(
16 start_date=start_date,
17 end_date=end_date,
18 )