@login_required
@require_http_methods(['GET', 'POST'])
def delete_avatar(request, group_slug):
 prof = get_object_or_404(GroupProfile, slug=group_slug)
 if (not _user_can_edit(request.user, prof)):
  raise PermissionDenied
 if (request.method == 'POST'):
  if prof.avatar:
   prof.avatar.delete()
  return HttpResponseRedirect(prof.get_absolute_url())
 return render(request, 'groups/confirm_avatar_delete.html', {'profile': prof})

@ login_required @ require_http_methods ( [ 'GET' , 'POST' ] ) def delete_avatar ( request , group_slug ) : prof = get_object_or_404 ( GroupProfile , slug = group_slug ) if ( not _user_can_edit ( request . user , prof ) ) : raise PermissionDenied if ( request . method == 'POST' ) : if prof . avatar : prof . avatar . delete ( ) return HttpResponseRedirect ( prof . get_absolute_url ( ) ) return render ( request , 'groups/confirm_avatar_delete.html' , { 'profile' : prof } )
delete user avatar .