def get(self, event_slug, payer_id): event = Event.get_by_slug(event_slug) if not event: abort(404) if payer_id is None: payers = [payer.get_json_data(url_for) for payer in event.payers] data = {'payers': payers} return json_response(data) else: payer = Payer.get_by_id_and_event_id(payer_id, event.id) if not payer: abort(404) return json_response(payer.get_json_data(url_for))
def get(self, event_slug, expense_id): event = Event.get_by_slug(event_slug) if not event: abort(404) if expense_id is None: expenses = [expense.get_json_data(url_for) for expense in event.expenses] data = {'expenses': expenses} return json_response(data) else: expense = Expense.get_by_id_and_event_id(expense_id, event.id) if not expense: abort(404) return json_response(expense.get_json_data())
def get(self, event_slug, expense_id): event = Event.get_by_slug(event_slug) if not event: abort(404) if expense_id is None: expenses = [ expense.get_json_data(url_for) for expense in event.expenses ] data = {'expenses': expenses} return json_response(data) else: expense = Expense.get_by_id_and_event_id(expense_id, event.id) if not expense: abort(404) return json_response(expense.get_json_data())
def get_event_or_abort(slug): event = Event.get_by_slug(slug) if not event or event.is_deleted(): abort(404) return event
def get(self, event_slug): event = Event.get_by_slug(event_slug) if not event: abort(404) return json_response(event.get_json_data(url_for))