@login_required
def group_join(request, slug, template_name='groups/group_join_confirm.html'):
 group = get_object_or_404(Group, slug=slug, is_active=True)
 if (request.method == 'POST'):
  membership = GroupMember(group=group, user=request.user)
  membership.save()
  return redirect(request, group)
 return render(request, template_name, {'group': group})

@ login_required def group_join ( request , slug , template_name = 'groups/group_join_confirm.html' ) : group = get_object_or_404 ( Group , slug = slug , is_active = True ) if ( request . method == 'POST' ) : membership = GroupMember ( group = group , user = request . user ) membership . save ( ) return redirect ( request , group ) return render ( request , template_name , { 'group' : group } )
returns a group join confirmation page .