<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import SitePermission


admin.site.register(SitePermission)<commit_msg>Create AdminViewPermission on contrib multisite<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils import timezone

from .models import SitePermission


class AdminViewPermission(admin.ModelAdmin):

    def queryset(self, request):
        queryset = super(AdminViewPermission, self).queryset(request)
        try:
            sitepermission = SitePermission.objects.get(
                user=request.user,
                date_available__lte=timezone.now(),
                published=True)
            return queryset.filter(site_iid=sitepermission.site_iid)
        except SitePermission.DoesNotExist:
            pass
        return queryset


admin.site.register(SitePermission)
{'fraction_non_alphanumeric': 0.09140369967355821, 'fraction_numerical': 0.002176278563656148, 'mean_word_length': 3.107142857142857, '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': '644804', 'n_tokens_mistral': 251, 'n_tokens_neox': 239, 'n_words': 54}