Example #1
0
def api_sendpush_list(request, format=None):

    if request.method == 'GET':
        data = api_api.api_list()
        return Response(data)
    elif request.method == 'POST':
        if check_permissions(request.user, 'cinemalog.add_sendpush'):
            data, stts = api_api.api_create(request.data, request.user)
            return Response(data, status=stts)
        return Response(data, status=status.HTTP_403_FORBIDDEN)
Example #2
0
def api_sendpush_detail(request, pk, format=None):
    if request.method == 'GET':
        data = api_api.api_detail(pk)
        return Response(data)

    elif request.method == 'PUT':
        if check_permissions(request.user, 'cinemalog.change_sendpush'):
            data, stts = api_api.api_update(request.data, request.user, pk)
            return Response(data, status=stts)
        else:
            return Response('no permission to update',
                            status=status.HTTP_403_FORBIDDEN)

    elif request.method == 'DELETE':
        if check_permissions(request.user, 'cinemalog.delete_sendpush'):
            stts = api_api.api_delete(pk)
            return Response('Delete Done', status=stts)
        else:
            return Response('no permission to delete',
                            status=status.HTTP_403_FORBIDDEN)
Example #3
0
 def delete(self, request, pk, format=None):
     if check_permissions(request.user, 'cinemalog.delete_sendpush'):
         stts = api_api.api_delete(pk)
         return Response('Delete Done', status=stts)
     return Response('no permission to delete',
                     status=status.HTTP_403_FORBIDDEN)
Example #4
0
 def put(self, request, pk, format=None):
     if check_permissions(request.user, 'cinemalog.change_sendpush'):
         data, stts = api_api.api_update(request.data, request.user, pk)
         return Response(data, status=stts)
     return Response('no permission to update',
                     status=status.HTTP_403_FORBIDDEN)
Example #5
0
 def post(self, request, format=None):
     if check_permissions(request.user, 'cinemalog.add_sendpush'):
         data, stts = api_api.api_create(request.data, request.user)
         return Response(data, status=stts)
     return Response(data, status=status.HTTP_403_FORBIDDEN)