def get(self, *args, **kwargs): pathway_cls = Pathway.get(kwargs['name']) pathway = pathway_cls( patient_id=kwargs.get("patient_id"), episode_id=kwargs.get("episode_id") ) serialised = _build_json_response( pathway.to_dict() ) return serialised
def create(self, request, **kwargs): pathway = Pathway.get(self.name)(episode_id=self.episode_id, patient_id=self.patient_id) data = _get_request_data(request) patient = pathway.save(data, request.user) redirect = pathway.redirect_url(patient) return Response({ "episode_id": patient.episode_set.last().id, "patient_id": patient.id, "redirect_url": redirect })
def create(self, request, **kwargs): pathway = Pathway.get(self.name)( episode_id=self.episode_id, patient_id=self.patient_id ) data = _get_request_data(request) patient = pathway.save(data, request.user) redirect = pathway.redirect_url(patient) return Response({ "episode_id": patient.episode_set.last().id, "patient_id": patient.id, "redirect_url": redirect })
def dispatch(self, *args, **kwargs): self.name = kwargs.get('name', 'pathway') self.pathway = Pathway.get(self.name) return super(PathwayTemplateView, self).dispatch(*args, **kwargs)
def get(self, *args, **kwargs): pathway_cls = Pathway.get(kwargs['name']) pathway = pathway_cls(patient_id=kwargs.get("patient_id"), episode_id=kwargs.get("episode_id")) serialised = _build_json_response(pathway.to_dict()) return serialised