Exemple #1
0
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)
Exemple #2
0
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))
Exemple #3
0
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))