def add_bookmark_view(request): result = {'error': False} form = AddBookmarkForm(request, request.POST) if form.is_valid(): bookmark = form.save() result['id'] = bookmark.pk else: result['error'] = True return JsonResponse(result)
def add_bookmark_view(request): result = {"error": False} form = AddBookmarkForm(request, request.POST) if form.is_valid(): bookmark = form.save() result["id"] = bookmark.pk else: result["error"] = True return JsonResponse(result)
def add_bookmark_view(request): result = {'error': False} form = AddBookmarkForm(request, request.POST) if form.is_valid(): bookmark = form.save() result.update({ 'id': bookmark.pk, 'title': bookmark.title, 'url': bookmark.url }) else: result['error'] = True return JsonResponse(result)
def add_bookmark_view(request): result = {"error": False} form = AddBookmarkForm(request, request.POST) if form.is_valid(): bookmark = form.save() result.update({ "id": bookmark.pk, "title": bookmark.title, "url": bookmark.url }) else: result["error"] = True return JsonResponse(result)