def enzyme_conc_new(self): enzyme_field = fl.enzyme_field() assay_field = fl.assay_field(blank=True, empty="", selected=request.params.get("assay_id", None)) author_field = fl.person_field() c.plate = None if request.params.get("plate_id", None): plate = Session.query(Plate).get(int(request.params.get("plate_id"))) if plate: c.plate = plate c.form = h.LiteralFormSelectPatch( value={ "enzyme_id": enzyme_field["value"], "assay_id": assay_field["value"], "author_id": author_field["value"], }, option={ "enzyme_id": enzyme_field["options"], "assay_id": assay_field["options"], "author_id": author_field["options"], }, ) return render("/assay/enzyme/new.html")
def enzyme_conc_edit(self, id=None): if id is None: abort(404) conc = Session.query(EnzymeConcentration).get(id) if not conc: abort(404) c.conc = conc enzyme_field = fl.enzyme_field(selected=unicode(conc.enzyme_id)) assay_field = fl.assay_field(blank=True, selected=unicode(conc.assay.id)) author_field = fl.person_field(selected=unicode(conc.author_id)) c.plate = None c.form = h.LiteralFormSelectPatch( value={ "enzyme_id": enzyme_field["value"], "assay_id": assay_field["value"], "author_id": author_field["value"], "minimum_conc": conc.minimum_conc, "maximum_conc": conc.maximum_conc, "source_plate_id": conc.source_plate_id, "notes": conc.notes, }, option={ "enzyme_id": enzyme_field["options"], "assay_id": assay_field["options"], "author_id": author_field["options"], }, ) return render("/assay/enzyme/edit.html")
def list(self): """ TODO: add pagination if necessary """ show_blanks = request.params.get("blank", False) if show_blanks: assay_q = Session.query(Assay) else: assay_q = Assay.populated_valid_query(Session) c.assays = assay_q.order_by(Assay.name).all() assay_field = fl.assay_field(empty="", include_empties=show_blanks, blank=True) c.assay_form = h.LiteralFormSelectPatch( value={"assay_id": assay_field["value"]}, option={"assay_id": assay_field["options"]} ) return render("/assay/list.html")