def submit_issue(request): """Create a new issue This should really be done in the REST API """ response = {"status": "ok"} try: installer = Installer.objects.get(slug=request.POST.get("installer")) except Installer.DoesNotExist: response["status"] = "error" response["message"] = "Could not find the installer" return HttpResponse(json.dumps(response)) content = request.POST.get("content") if not content: response["status"] = "error" response["message"] = "The issue content is empty" return HttpResponse(json.dumps(response)) installer_issue = InstallerIssue( installer=installer, submitted_by=request.user, description=content ) installer_issue.save() notify_issue_creation(installer_issue, request.user, content) return JsonResponse(response)
def submit_issue(request): response = {'status': 'ok'} try: installer = Installer.objects.get(slug=request.POST.get('installer')) except Installer.DoesNotExist: response['status'] = 'error' response['message'] = 'Could not find the installer' return HttpResponse(json.dumps(response)) content = request.POST.get('content') if not content: response['status'] = 'error' response['message'] = 'The issue content is empty' return HttpResponse(json.dumps(response)) installer_issue = InstallerIssue(installer=installer, submitted_by=request.user, description=content) installer_issue.save() notify_issue_creation(installer_issue, request.user, content) return HttpResponse(json.dumps(response))
def submit_issue(request): response = {"status": "ok"} try: installer = Installer.objects.get(slug=request.POST.get("installer")) except Installer.DoesNotExist: response["status"] = "error" response["message"] = "Could not find the installer" return HttpResponse(json.dumps(response)) content = request.POST.get("content") if not content: response["status"] = "error" response["message"] = "The issue content is empty" return HttpResponse(json.dumps(response)) installer_issue = InstallerIssue( installer=installer, submitted_by=request.user, description=content ) installer_issue.save() notify_issue_creation(installer_issue, request.user, content) return HttpResponse(json.dumps(response))