<commit_before>from django.contrib.admin import AdminSite
from django.contrib.auth.models import User, Group
from avocado.models import *
from avocado.admin import *

class MainAdminSite(AdminSite):
    "This acts as the main admin site for superusers."
    def has_permission(self, request):
        return super(MainAdminSite, self).has_permission(request) and \
            request.user.is_superuser


class EditorsAdminSite(AdminSite):
    "The admin site for editors of meta data."
    def has_permission(self, request):
        user = request.user
        has_perm = user.groups.filter(name__iexact='editors').count() > 0
        return super(EditorsAdminSite, self).has_permission(request) and \
            has_perm or user.is_superuser

<commit_msg>changed to newer exists() method for better performance<commit_after>from django.contrib.admin import AdminSite
from django.contrib.auth.models import User, Group
from avocado.models import *
from avocado.admin import *

class MainAdminSite(AdminSite):
    "This acts as the main admin site for superusers."
    def has_permission(self, request):
        return super(MainAdminSite, self).has_permission(request) and \
            request.user.is_superuser


class EditorsAdminSite(AdminSite):
    "The admin site for editors of meta data."
    def has_permission(self, request):
        user = request.user
        has_perm = user.groups.filter(name__iexact='editors').exists()
        return super(EditorsAdminSite, self).has_permission(request) and \
            has_perm or user.is_superuser


{'fraction_non_alphanumeric': 0.08295819935691319, 'fraction_numerical': 0.0006430868167202572, 'mean_word_length': 3.7151515151515153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4416574', 'n_tokens_mistral': 436, 'n_tokens_neox': 425, 'n_words': 124}