Pre- pydsubmission toForm method.

This commit is contained in:
Landon Wark
2023-10-25 14:58:41 -05:00
parent 4b1f88f1d0
commit f3a7d75c6a
11 changed files with 298 additions and 115 deletions

View File

@@ -7,6 +7,7 @@ from sqlalchemy.orm import relationship, validates
from sqlalchemy.ext.associationproxy import association_proxy
from datetime import date
import logging
from tools import Settings, check_authorization
logger = logging.getLogger(f'submissions.{__name__}')
@@ -100,6 +101,11 @@ class KitType(Base):
map['info'] = {}
return map
@check_authorization
def save(self, ctx:Settings):
ctx.database_session.add(self)
ctx.database_session.commit()
class ReagentType(Base):
"""
Base of reagent type abstract
@@ -265,12 +271,21 @@ class Reagent(Base):
rtype = reagent_role.name
except AttributeError:
rtype = "Unknown"
try:
expiry = self.expiry.strftime("%Y-%m-%d")
except:
expiry = date.today()
return {
"name":self.name,
"type": rtype,
"lot": self.lot,
"expiry": self.expiry.strftime("%Y-%m-%d")
}
def save(self, ctx:Settings):
ctx.database_session.add(self)
ctx.database_session.commit()
class Discount(Base):
"""