def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch( id=self.barrier_id, companies=self.cleaned_data["companies"], )
def get_full_history(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) barrier_id = self.kwargs.get("barrier_id") full_history = client.barriers.get_full_history(barrier_id=barrier_id) full_history.sort(key=lambda object: object.date, reverse=True) return full_history
def get_interactions(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) activity = client.barriers.get_activity(barrier_id=self.barrier.id) interactions = self.notes + activity interactions.sort(key=lambda object: object.date, reverse=True) return interactions
def get_report(self): client = MarketAccessAPIClient(self.request.session["sso_token"]) return client.reports.get(self.kwargs.get("barrier_id"))
def save(self): client = MarketAccessAPIClient(self.token) client.public_barrier_notes.patch( id=self.note_id, text=self.cleaned_data["note"], )
def has_permission(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) user = client.users.get_current() return all( user.has_permission(permission) for permission in self.get_permission_required())
def post(self, request, *args, **kwargs): team_member_id = self.kwargs.get("team_member_id") client = MarketAccessAPIClient(self.request.session.get("sso_token")) client.barriers.delete_team_member(team_member_id) return HttpResponseRedirect(self.get_success_url())
def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch( id=self.id, caused_by_trading_bloc=self.cleaned_data["caused_by_trading_bloc"], )
def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch(id=self.id, title=self.cleaned_data["title"])
def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch( id=self.id, end_date=self.cleaned_data.get("end_date"), )
def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch( id=self.id, trade_direction=self.cleaned_data["trade_direction"])
def get(self, request, mention_id): client = MarketAccessAPIClient(self.request.session.get("sso_token")) client.mentions.mark_as_read(mention_id) return HttpResponseRedirect("/?active=mentions")
def get(self, request): client = MarketAccessAPIClient(self.request.session.get("sso_token")) client.notification_exclusion.turn_on_notifications() return HttpResponseRedirect("/?active=mentions")
def get(self, request, mention_id): client = MarketAccessAPIClient(self.request.session.get("sso_token")) mention = client.mentions.get(mention_id) client.mentions.mark_as_read(mention_id) return HttpResponseRedirect(mention.go_to_url_path)
def client(self): return MarketAccessAPIClient(self.request.session.get("sso_token"))
def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch(id=self.id, product=self.cleaned_data["product"])
def get_group(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) group_id = self.get_group_id() if group_id: return client.groups.get(group_id)
def client(self): if self._client is None: self._client = MarketAccessAPIClient( self.request.session.get("sso_token")) return self._client
def save(self): client = MarketAccessAPIClient(self.token) client.public_barriers.patch( id=self.id, summary=self.cleaned_data.get("summary"), )
def get_saved_search(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) saved_search_id = self.kwargs.get("saved_search_id") return client.saved_searches.get(saved_search_id)
def get_context_data(self, **kwargs): context_data = super().get_context_data(**kwargs) client = MarketAccessAPIClient(self.request.session["sso_token"]) reports = client.reports.list(ordering="-created_on") context_data["reports"] = reports return context_data
def post(self, request, *args, **kwargs): client = MarketAccessAPIClient(self.request.session.get("sso_token")) saved_search_id = str(self.kwargs.get("saved_search_id")) client.saved_searches.delete(saved_search_id) return HttpResponseRedirect(reverse("barriers:dashboard"))
def client(self): if not self._client: self._client = MarketAccessAPIClient( self.request.session["sso_token"]) return self._client
def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch(id=self.id, **self.get_api_params())
def save(self): client = MarketAccessAPIClient(self.token) client.public_barriers.create_note( id=self.barrier_id, text=self.cleaned_data["note"], )
def get_public_barrier(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) barrier_id = self.kwargs.get("barrier_id") return client.public_barriers.get(id=barrier_id)
def save(self): client = MarketAccessAPIClient(self.token) client.barriers.patch( id=self.barrier.id, trade_category=self.cleaned_data["trade_category"])
def get_user(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) user_id = self.kwargs.get("user_id") return client.users.get(user_id)
def get_notes(self): client = MarketAccessAPIClient(self.request.session.get("sso_token")) return client.notes.list(barrier_id=self.barrier.id)
def get_redirect_url(self, *args, **kwargs): client = MarketAccessAPIClient(self.request.session.get("sso_token")) document_id = self.kwargs.get("document_id") data = client.documents.get_download(document_id) return data["document_url"]