Beispiel #1
0
def project_edit(request, project_id):
    if request.method == 'POST':
        form = ProjectForm(request.POST)
        if form.is_valid():
            project = get_object_or_404(Project, pk=project_id)
            project.name = form.cleaned_data['project_name']
            project.description = form.cleaned_data['project_desc']
            project.save()
            return HttpResponse(json.dumps({'success': 'Great Success!'}),
                                content_type='application/json',
                                status=201)
    return HttpResponse(json.dumps({'error': 'Epic Fail.'}),
                        content_type='application/json',
                        status=400)
Beispiel #2
0
def project_edit(request, project_id):
    if request.method == 'POST':
        form = ProjectForm(request.POST)
        if form.is_valid():
            project = get_object_or_404(Project, pk=project_id)
            project.name = form.cleaned_data['project_name']
            project.description = form.cleaned_data['project_desc']
            project.save()
            return HttpResponse(
                json.dumps({'success': 'Great Success!'}),
                content_type='application/json',
                status=201
            )
    return HttpResponse(
        json.dumps({'error': 'Epic Fail.'}),
        content_type='application/json',
        status=400
    )
Beispiel #3
0
def create_project(request):
    if request.method == 'POST':
        form = ProjectForm(request.POST)
        if form.is_valid():
            project = Project()
            project.name = form.cleaned_data['project_name']
            project.description = form.cleaned_data['project_desc']
            project.save()
            project_member = ProjectMember()
            project_member.project = project
            project_member.user = request.user
            project_member.owner = True
            project_member.save()
            return HttpResponse(json.dumps({'success': 'Great Success!'}),
                                content_type='application/json',
                                status=201)
    return HttpResponse(json.dumps({'error': 'Epic Fail.'}),
                        content_type='application/json',
                        status=400)
Beispiel #4
0
def create_project(request):
    if request.method == 'POST':
        form = ProjectForm(request.POST)
        if form.is_valid():
            project = Project()
            project.name = form.cleaned_data['project_name']
            project.description = form.cleaned_data['project_desc']
            project.owner = request.user
            project.save()
            return HttpResponse(
                json.dumps({'success': 'Great Success!'}),
                content_type='application/json',
                status=201
            )
    return HttpResponse(
        json.dumps({'error': 'Epic Fail.'}),
        content_type='application/json',
        status=400
    )