<commit_before># Course admin interface
import django.contrib.admin
from django.db.models import Q
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.utils.html import format_html

def assignments(course):
    return ",\n".join([str(ass) for ass in course.assignments.all()])

def actions(course):
    allow_tags=True
    result  = format_html('<a href="%s">Download course archive</a><br/>'%reverse('coursearchive', args=(course.pk,)))
    result += format_html('<a href="%s">Show grading table</a><br/>'%reverse('gradingtable', args=(course.pk,)))
    result += format_html('<a href="%s">eMail to students</a>'%reverse('mail2all', args=(course.pk,)))
    return result

class CourseAdmin(django.contrib.admin.ModelAdmin):
    list_display = ['__unicode__', 'active', 'owner', assignments, 'max_authors', actions]
    filter_horizontal = ['tutors']

    def get_queryset(self, request):
        ''' Restrict the listed courses for the current user.'''
        qs = super(CourseAdmin, self).get_queryset(request)
        if request.user.is_superuser:
            return qs
        else:
            return qs.filter(Q(tutors__pk=request.user.pk) | Q(owner=request.user)).distinct()
<commit_msg>Some CSS, fixes #45<commit_after># Course admin interface
import django.contrib.admin
from django.db.models import Q
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.utils.html import format_html

def assignments(course):
    return ",\n".join([str(ass) for ass in course.assignments.all()])

def actions(course):
    allow_tags=True
    result  = format_html('<a href="%s" style="white-space: nowrap">Download course archive</a><br/>'%reverse('coursearchive', args=(course.pk,)))
    result += format_html('<a href="%s" style="white-space: nowrap">Show grading table</a><br/>'%reverse('gradingtable', args=(course.pk,)))
    result += format_html('<a href="%s" style="white-space: nowrap">eMail to students</a>'%reverse('mail2all', args=(course.pk,)))
    return result

class CourseAdmin(django.contrib.admin.ModelAdmin):
    list_display = ['__unicode__', 'active', 'owner', assignments, 'max_authors', actions]
    filter_horizontal = ['tutors']

    def get_queryset(self, request):
        ''' Restrict the listed courses for the current user.'''
        qs = super(CourseAdmin, self).get_queryset(request)
        if request.user.is_superuser:
            return qs
        else:
            return qs.filter(Q(tutors__pk=request.user.pk) | Q(owner=request.user)).distinct()

{'fraction_non_alphanumeric': 0.14925954793452845, 'fraction_numerical': 0.001558846453624318, 'mean_word_length': 4.568329718004338, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4016115', 'n_tokens_mistral': 791, 'n_tokens_neox': 770, 'n_words': 181}