<commit_before>from django.template import Context
from django.views.generic.list_detail import object_list, object_detail

from knesset.utils import limit_by_request, yearstart
from knesset.mks.models import Member, Party

def member (request, pk=None):
    qs = Member.objects.all()
    if pk:
        return object_detail(request, queryset=qs, object_id=pk, 
                             template_name='mks/member.html')
    else:
        qs = qs.filter(end_date__gte=yearstart(2009))
        return object_list(request, queryset=qs, 
                           template_name='mks/members.html')

def party (request, pk=None):
    qs = Party.objects.all()
    if pk:
        return object_detail(request, queryset=qs, object_id=pk, 
                             template_name='mks/party.html')
    else:
        # return a list
        qs = limit_by_request(qs, request)
        return object_list(request, queryset=qs,template_name='mks/parties.html')
<commit_msg>added login required<commit_after>from django.template import Context
from django.views.generic.list_detail import object_list, object_detail

from knesset.utils import limit_by_request, yearstart
from knesset.mks.models import Member, Party

from django.contrib.auth.decorators import login_required

@login_required
def member (request, pk=None):
    qs = Member.objects.all()
    if pk:
        return object_detail(request, queryset=qs, object_id=pk, 
                             template_name='mks/member.html')
    else:
        qs = qs.filter(end_date__gte=yearstart(2009))
        return object_list(request, queryset=qs, 
                           template_name='mks/members.html')

def party (request, pk=None):
    qs = Party.objects.all()
    if pk:
        return object_detail(request, queryset=qs, object_id=pk, 
                             template_name='mks/party.html')
    else:
        # return a list
        qs = limit_by_request(qs, request)
        return object_list(request, queryset=qs,template_name='mks/parties.html')

{'fraction_non_alphanumeric': 0.09415262636273539, 'fraction_numerical': 0.003964321110009911, 'mean_word_length': 2.8238636363636362, 'pattern_counts': {'":': 0, '<': 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': '2232767', 'n_tokens_mistral': 627, 'n_tokens_neox': 606, 'n_words': 131}