<commit_before>from django.views.generic import TemplateView
from django.core.urlresolvers import reverse
from ..models import LogEntry
# from ..util import paginate


class EventLogView(TemplateView):
    template_name = 'students/events_log.html'

    def get_context_data(self, **kwargs):
        context = super(EventLogView, self).get_context_data(**kwargs)
        context['events_log_url'] = reverse('events_log')

        events_log = LogEntry.objects.all()
        # .order_by('timestamp').reverse()[:100]

        # events_log = [
        #     {'timestamp': '2016.01.01-15:01', 'evt_type': 'C', 'evt_user': 'User1', 'evt_description': 'Created user <NAME>.'},
        #     {'timestamp': '2016.01.01-16:01', 'evt_type': 'U', 'evt_user': 'User1', 'evt_description': 'Updated user Ivanov A.A.'},
        #     {'timestamp': '2016.01.01-17:01', 'evt_type': 'D', 'evt_user': 'User123', 'evt_description': 'Deleted user <NAME>.'},
        #     {'timestamp': '2016.01.01-18:01', 'evt_type': 'U', 'evt_user': 'User123', 'evt_description': 'Updated user Salo S.S.'},
        # ]

        context['events_log'] = events_log

        # apply pagination, 2 groups per page
        # context.update(paginate(events_log, 2, self.request, {}, var_name='events_log'))

        return context<commit_msg>LogEntry<commit_after>from django.views.generic import TemplateView
from django.core.urlresolvers import reverse
from ..models import LogEntry
from ..util import paginate


class EventLogView(TemplateView):
    template_name = 'students/events_log.html'

    def get_context_data(self, **kwargs):
        context = super(EventLogView, self).get_context_data(**kwargs)
        context['events_log_url'] = reverse('events_log')

        events_log = LogEntry.objects.all().order_by('-timestamp')
        context['events_log'] = events_log

        # apply pagination, 10 events per page
        context.update(paginate(events_log, 10, self.request, {}, var_name='events_log'))

        return context
{'fraction_non_alphanumeric': 0.14964964964964966, 'fraction_numerical': 0.032532532532532535, 'mean_word_length': 3.7257683215130024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2334772', 'n_tokens_mistral': 664, 'n_tokens_neox': 622, 'n_words': 131}