<commit_before>from django.contrib import admin

from permissions.models import ObjectPermission
admin.site.register(ObjectPermission)

from permissions.models import Permission
admin.site.register(Permission)

from permissions.models import Role
admin.site.register(Role)

from permissions.models import PrincipalRoleRelation
admin.site.register(PrincipalRoleRelation)<commit_msg>update admin<commit_after>from django.contrib import admin
from permissions.models import ObjectPermission, PrincipalRoleRelation, Role, Permission


class ObjectPermissionAdmin(admin.ModelAdmin):
    list_display = ('pk', 'role', 'permission', 'content')
    list_filter = ('role', 'permission')

admin.site.register(ObjectPermission, ObjectPermissionAdmin)


class PermissionAdmin(admin.ModelAdmin):
    list_display = ('codename', 'name', 'types')
    search_fields = ('codename', 'name')

    def types(self, obj):
        return ','.join([x.name for x in obj.content_types.all()])

admin.site.register(Permission, PermissionAdmin)


class RoleAdmin(admin.ModelAdmin):
    list_display = ('codename', 'name', 'perms')
    search_fields = ('codename', 'name')

    def perms(self, obj):
        return ','.join([x.codename for x in obj.global_permissions.all()])

admin.site.register(Role, RoleAdmin)


class PrincipalRoleRelationAdmin(admin.ModelAdmin):
    list_display = ('pk', 'role', 'user', 'group', 'content')
    list_filter = ('role', 'group')

admin.site.register(PrincipalRoleRelation, PrincipalRoleRelationAdmin)
{'fraction_non_alphanumeric': 0.1240053050397878, 'fraction_numerical': 0.0, 'mean_word_length': 5.953917050691245, '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': '73549', 'n_tokens_mistral': 436, 'n_tokens_neox': 418, 'n_words': 100}