def booking_detail_token(request, token): try: booking_id = decode_token(token) except Exception: return JsonResponse({"message": "Invalid token"}, status=status.HTTP_403_FORBIDDEN) return views_template.obj_detail(request, booking_id, Booking, BookingSerializer)
def email_template_detail_populated(request, pk, booking_pk): response = views_template.obj_detail(request, pk, EmailTemplate, EmailtemplateSerializer) if response.status_code != status.HTTP_200_OK: return response else: data = json.loads(response.content.decode('utf-8')) data["template"] = populate_template(data["template"], booking_pk) return JsonResponse(data=data, status=status.HTTP_200_OK)
def booking_detail(request, pk): return views_template.obj_detail(request, pk, Booking, BookingSerializer)
def email_template_detail(request, pk): return views_template.obj_detail(request, pk, EmailTemplate, EmailtemplateSerializer)
def booked_item_detail(request, pk): return views_template.obj_detail(request, pk, BookedItem, BookedItemSerializer)
def item_detail(request, pk): return views_template.obj_detail(request, pk, Item, ItemSerializer)
def confirmation_template_detail(request, pk): return views_template.obj_detail(request, pk, ConfirmationEmail, ConfirmationEmailSerializer)