Example #1
0
def booking_list(request):
    response = views_template.obj_list(request, Booking, BookingSerializer)
    if request.method == 'POST':
        if response.status_code == status.HTTP_201_CREATED:
            send_confirmation_email(json.loads(response.content.decode("utf-8")))
        return response
    else:
        return response
Example #2
0
 def create(self, request, *args, **kwargs):
     response = views_template.obj_list(request, Booking, BookingSerializer)
     if response.status_code == status.HTTP_201_CREATED:
         try:
             send_confirmation_email(
                 json.loads(response.content.decode("utf-8")))
         except SMTPException:
             return JsonResponse(
                 {"message": "Problem with email sending"},
                 status=status.HTTP_500_INTERNAL_SERVER_ERROR)
     return response
Example #3
0
def email_template_list(request):
    return views_template.obj_list(request, EmailTemplate,
                                   EmailtemplateSerializer)
Example #4
0
def booked_item_list(request):
    return views_template.obj_list(request, BookedItem, BookedItemSerializer)
Example #5
0
def item_list(request):
    return views_template.obj_list(request, Item, ItemSerializer)
Example #6
0
def confirmation_template_list(request):
    return views_template.obj_list(request, ConfirmationEmail,
                                   ConfirmationEmailSerializer)