forked from enviPath/enviPy
Scenario Import + Gitea PR Test (#1)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#1
This commit is contained in:
@ -3,7 +3,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
from collections import defaultdict
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, timedelta, date
|
||||
from typing import Union, List, Optional
|
||||
from uuid import uuid4
|
||||
|
||||
@ -1343,14 +1343,38 @@ class PluginModel(EPModel):
|
||||
# # # TODO consider Scenario, BaseScenario, RelatedScenario
|
||||
class Scenario(EnviPathModel):
|
||||
package = models.ForeignKey('epdb.Package', verbose_name='Package', on_delete=models.CASCADE, db_index=True)
|
||||
date = models.DateField(null=True, verbose_name='Study date')
|
||||
type = models.CharField(max_length=256, null=False, blank=False, default='No date')
|
||||
type = models.CharField(max_length=256, null=False, blank=False, default='Not specified')
|
||||
|
||||
additional_information = models.JSONField(verbose_name='Additional Information')
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return '{}/scenario/{}'.format(self.package.url, self.uuid)
|
||||
|
||||
@staticmethod
|
||||
@transaction.atomic
|
||||
def create(package, name, description, date, type, additional_information):
|
||||
s = Scenario()
|
||||
s.package = package
|
||||
s.name = name
|
||||
s.description = description
|
||||
s.date = date
|
||||
s.type = type
|
||||
s.additional_information = additional_information
|
||||
|
||||
s.save()
|
||||
|
||||
return s
|
||||
|
||||
def add_additional_information(self, data):
|
||||
pass
|
||||
|
||||
def remove_additional_information(self, data):
|
||||
pass
|
||||
|
||||
def set_additional_information(self, data):
|
||||
pass
|
||||
|
||||
example = {
|
||||
"additionalInformationCollection": {
|
||||
|
||||
Reference in New Issue
Block a user