def getEmailTemplate(request):
if request.method != '<STR_LIT:POST>':<EOL><INDENT>return HttpResponse(_('<STR_LIT>'))<EOL><DEDENT>if not hasattr(request,'<STR_LIT:user>'):<EOL><INDENT>return HttpResponse(_('<STR_LIT>'))<EOL><DEDENT>template_id = request.POST.get('<STR_LIT>')<EOL>if not template_id:<EOL><INDENT>return HttpResponse(_("<STR_LIT>"))<EOL><DEDENT>try:<EOL><INDENT>this_template = EmailTemplate.objects.get(id=template_id)<EOL><DEDENT>except ObjectDoesNotExist:<EOL><INDENT>return HttpResponse(_("<STR_LIT>"))<EOL><DEDENT>if this_template.groupRequired and this_template.groupRequired not in request.user.groups.all():<EOL><INDENT>return HttpResponse(_("<STR_LIT>"))<EOL><DEDENT>if this_template.hideFromForm:<EOL><INDENT>return HttpResponse(_("<STR_LIT>"))<EOL><DEDENT>return JsonResponse({<EOL>'<STR_LIT>': this_template.subject,<EOL>'<STR_LIT:content>': this_template.content,<EOL>'<STR_LIT>': this_template.html_content,<EOL>'<STR_LIT>': this_template.richTextChoice,<EOL>})<EOL>
This function handles the Ajax call made when a user wants a specific email template