0
def post(self, request, *args, **kwargs):
        post_data = request.data
        task_id = post_data.get("task_id")
        head = post_data.get("comment_head")
        value = post_data.get("comment_description")
        code = post_data.get("code")
        task = entity_Task(task_id=task_id)
        if task and head and value:
            try:
                if code and code == DELAY_FLAG_CODE:
                    entity_Comment.add_comment_flag_delay(
                        user=user, task_id=task_id, value=collection_feedback)
                else:
                    comment = entity_Comment.add_comment_with_task_id(
                        user=request.user, task_id=task_id, head=head, value=value)
                return JSONResponse({'code': 200, 'response': {"status": "Comment Saved"}})
            except Exception as e:
                xprint(e, traceback.format_exc())
                return JSONResponse({'code': 500, 'response': {"error": str(e)}});
        return JSONResponse({'code':200,'response':'Data Insufficient'})

after running this code in vscode editor I get below error

IndentationError: unindent does not match any outer indentation level.

Nishad K
  • 51
  • 1
  • Welcome to Stack Overflow! Your headline is not very helpful, please consider editing it. Include maybe the error not the name of your IDE. Have a look [how to ask](https://stackoverflow.com/questions/how-to-ask). It's also part of the good tone here at SA to ask only after intensive research. If you search for your error as SA or google I bet you'll find dozens of helpful hits, because it is a standard python thing. Even eth first hit may help you: https://stackoverflow.com/questions/492387/indentationerror-unindent-does-not-match-any-outer-indentation-level – Paflow Jan 23 '20 at 08:13

1 Answers1

1

Easiest way to hunt out something like this would be to use a formatter (like black) to ensure consistent formatting in your code. From inside VSCode, you can just use ctrl+shift+F to format the current file - this may be enough for your current task.

Otherwise, check the exact line from the traceback and ensure your indentation is correct / matches the rest of your file / function..

Oliver.R
  • 1,282
  • 7
  • 17