Beispiel #1
0
def group_invite(request, slug):
    group = get_object_or_404(GroupProfile, slug=slug)

    if not group.can_invite(request.user):
        raise Http404()

    form = GroupInviteForm(request.POST)

    if form.is_valid():
        for user in form.cleaned_data["invite_user_identifiers"].split("\n"):
            group.invite(
                user,
                request.user,
                role=form.cleaned_data["invite_role"],
            )

            # notify user that he/she is invited by the group
            try:
                requested_user = Profile.objects.get(email=user)
            except:
                pass
            else:
                notify.send(request.user, recipient=requested_user, actor=request.user,
                verb='invited you to join')

    return redirect("group_members", slug=group.slug)
Beispiel #2
0
def group_invite(request, slug):
    group = get_object_or_404(GroupProfile, slug=slug)

    if not group.can_invite(request.user):
        raise Http404()

    form = GroupInviteForm(request.POST)

    if form.is_valid():
        for user in form.cleaned_data["invite_user_identifiers"].split("\n"):
            group.invite(
                user,
                request.user,
                role=form.cleaned_data["invite_role"],
            )

            # notify user that he/she is invited by the group
            try:
                requested_user = Profile.objects.get(email=user)
            except:
                pass
            else:
                notify.send(request.user, recipient=requested_user, actor=request.user,
                verb='invited you to join')

    return redirect("group_members", slug=group.slug)
Beispiel #3
0
def group_invite(request, slug):
    group = get_object_or_404(GroupProfile, slug=slug)
    
    if not group.can_invite(request.user):
        raise Http404()
    
    form = GroupInviteForm(request.POST)
    
    if form.is_valid():
        for user in form.cleaned_data["invite_user_identifiers"].split("\n"):
            group.invite(user, request.user, role=form.cleaned_data["invite_role"])
    
    return redirect("group_members", slug=group.slug)
Beispiel #4
0
def group_invite(request, slug):
    group = get_object_or_404(GroupProfile, slug=slug)

    if not group.can_invite(request.user):
        raise Http404()

    form = GroupInviteForm(request.POST)

    if form.is_valid():
        for user in form.cleaned_data["invite_user_identifiers"].split("\n"):
            group.invite(user,
                         request.user,
                         role=form.cleaned_data["invite_role"])

    return redirect("group_members", slug=group.slug)
Beispiel #5
0
def initiative_members(request, slug):
    group = get_object_or_404(GroupProfile, slug=slug)
    ctx = {}

    if not group.can_view(request.user):
        raise Http404()

    if group.access in [
            "public-invite",
            "private"] and group.user_is_role(
            request.user,
            "manager"):
        ctx["invite_form"] = GroupInviteForm()

    if group.user_is_role(request.user, "manager"):
        ctx["member_form"] = GroupMemberForm()

    ctx.update({
        "group": group,
        "members": group.member_queryset(),
        "is_member": group.user_is_member(request.user),
        "is_manager": group.user_is_role(request.user, "manager"),
    })
    ctx = RequestContext(request, ctx)
    return render_to_response("groups/initiative_members.html", ctx)