<commit_before>from django.contrib import admin
from models import (Province, District, Zone, School)

class SchoolAdmin(admin.ModelAdmin):
    list_display = ["emis", "name", "zone"]

admin.site.register(Province)
admin.site.register(District)
admin.site.register(Zone)
admin.site.register(School, SchoolAdmin)<commit_msg>added filtering for schools in hierarchy<commit_after>from django.contrib import admin
from models import (Province, District, Zone, School)

class SchoolAdmin(admin.ModelAdmin):
    list_display = ["emis", "name", "zone"]

    def queryset(self, request):
        """
        Limits queries for pages that belong to district admin
        """
        qs = super(SchoolAdmin, self).queryset(request)
        if request.user.is_superuser:
            return qs
        return qs.filter(zone__district=request.user.userdistrict.district_id)

admin.site.register(Province)
admin.site.register(District)
admin.site.register(Zone)
admin.site.register(School, SchoolAdmin)
{'fraction_non_alphanumeric': 0.1102123356926188, 'fraction_numerical': 0.0, 'mean_word_length': 4.561797752808989, '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': '2312153', 'n_tokens_mistral': 293, 'n_tokens_neox': 278, 'n_words': 69}