Beispiel #1
0
def project_users(request, project_slug):
    """Project users view and form view."""
    project = get_object_or_404(
        Project.objects.for_admin_user(request.user),
        slug=project_slug,
    )

    form = UserForm(data=request.POST or None, project=project)

    if request.method == 'POST' and form.is_valid():
        form.save()
        project_dashboard = reverse('projects_users', args=[project.slug])
        return HttpResponseRedirect(project_dashboard)

    users = project.users.all()

    return render(
        request,
        'projects/project_users.html',
        {
            'form': form,
            'project': project,
            'users': users
        },
    )
Beispiel #2
0
def project_users(request, project_slug):
    project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)

    form = UserForm(data=request.POST or None, project=project)

    if request.method == "POST" and form.is_valid():
        form.save()
        project_dashboard = reverse("projects_users", args=[project.slug])
        return HttpResponseRedirect(project_dashboard)

    users = project.users.all()

    return render_to_response(
        "projects/project_users.html",
        {"form": form, "project": project, "users": users},
        context_instance=RequestContext(request),
    )
Beispiel #3
0
def project_users(request, project_slug):
    """Project users view and form view"""
    project = get_object_or_404(Project.objects.for_admin_user(request.user),
                                slug=project_slug)

    form = UserForm(data=request.POST or None, project=project)

    if request.method == 'POST' and form.is_valid():
        form.save()
        project_dashboard = reverse('projects_users', args=[project.slug])
        return HttpResponseRedirect(project_dashboard)

    users = project.users.all()

    return render_to_response(
        'projects/project_users.html',
        {'form': form, 'project': project, 'users': users},
        context_instance=RequestContext(request)
    )