Example #1
0
def invite(request, group, template_name='plus_groups/invite.html', current_app='plus_groups', **kwargs):
    if request.POST :
        form = TgGroupMemberInviteForm(request.POST)
        if form.is_valid() :
            invited = form.cleaned_data['user']
            group.invite_member(invited, form.cleaned_data['special_message'], request.user, request.get_host())
            return HttpResponseRedirect(reverse(current_app + ':group',args=(group.id,)))

            
    else :
        form = TgGroupMemberInviteForm()
    return render_to_response(template_name,{
            'form' : form,
            'group' : group,
            }, context_instance=RequestContext(request, current_app=current_app))
Example #2
0
def invite(request, group, template_name='plus_groups/invite.html', current_app='plus_groups', **kwargs):
    if request.user == get_anon_user():
        return HttpResponseRedirect(reverse('acct_invite'))

    if request.POST :
        form = TgGroupMemberInviteForm(request.POST)
        if form.is_valid() :
            invited = form.cleaned_data['invited']
            from apps.plus_groups.models import invite_to_group
            invite_to_group(group,invited,request.user,form.cleaned_data['special_message'])
            message = _("You have invited %(invited)s to %(group)s.") % {'invited':invited,'group':group.get_display_name()}
            request.user.message_set.create(message=message)

            return HttpResponseRedirect(reverse(current_app + ':group',args=(group.id,)))
            
    else :
        form = TgGroupMemberInviteForm()
    return render_to_response(template_name,{
            'form' : form,
            'group' : group,
            'group_id' : group.id,
            }, context_instance=RequestContext(request, current_app=current_app))