<commit_before>from django.http import HttpResponse
from django.template import RequestContext, loader
from django_app_lti.views import LTILaunchView

def index(request):
    template = loader.get_template('index.html')
    context = RequestContext(request, {})
    #content = 'Welcome to my app. Course ID: %s User: %s' % (course_id, request.user.email)
    #return HttpResponse(content)
    return HttpResponse(template.render(context))

class MyLTILaunchView(LTILaunchView):
    def hook_before_post(self, request):
        super(MyLTILaunchView, self).hook_before_post(request)
        print "before post"<commit_msg>sending a json context to the indext template<commit_after>from django.http import HttpResponse
from django.template import RequestContext, loader
from django_app_lti.views import LTILaunchView

import json
import re

def index(request):

    template = loader.get_template('index.html')
    edit = False;
    if re.search('Instructor', request.LTI['roles'][0]):
        edit = True;
    context = {
        "data": {
            "edit": edit,
            "user_id": request.user.username,
            "course_id": request.LTI['custom_canvas_course_id'],
        },
    };
    request_context = RequestContext(request, context)

    return HttpResponse(template.render(request_context))

class MyLTILaunchView(LTILaunchView):
    def hook_before_post(self, request):
        super(MyLTILaunchView, self).hook_before_post(request)
        print "before post"
{'fraction_non_alphanumeric': 0.10081190798376184, 'fraction_numerical': 0.0006765899864682003, 'mean_word_length': 4.047781569965871, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4295772', 'n_tokens_mistral': 441, 'n_tokens_neox': 436, 'n_words': 102}