<commit_before>from consents.models import Consent
from consents.models import Term, TermOption
from django.contrib import admin


class TermOptionInline(admin.TabularInline):
    model = TermOption
    extra = 0


class TermAdmin(admin.ModelAdmin):
    list_display = ("slug", "content", "required_type")
    inlines = [
        TermOptionInline,
    ]


class ConsentAdmin(admin.ModelAdmin):
    list_display = ("person", "term", "term_option", "get_term_option_type")
    readonly_fields = ("person", "term", "term_option", "archived_at")
    search_fields = ("person__personal", "person__family", "person__email")
    list_filter = ["term", "term_option__option_type", "archived_at"]

    def get_term_option_type(self, obj):
        return obj.term_option.option_type

    get_term_option_type.short_description = "Term Option Type"
    get_term_option_type.admin_order_field = "term_option__option_type"


admin.site.register(Term, TermAdmin)
admin.site.register(Consent, ConsentAdmin)<commit_msg>Small changes to admin view<commit_after>from consents.models import Consent
from consents.models import Term, TermOption
from django.contrib import admin


class TermOptionInline(admin.TabularInline):
    model = TermOption
    extra = 0


class TermAdmin(admin.ModelAdmin):
    list_display = ("slug", "content", "required_type")
    inlines = [
        TermOptionInline,
    ]


class ConsentAdmin(admin.ModelAdmin):
    list_display = (
        "created_at",
        "person",
        "term",
        "term_option",
        "get_term_option_type",
        "archived_at",
    )
    readonly_fields = ("person", "term", "term_option", "archived_at")
    search_fields = ("person__personal", "person__family", "person__email")
    list_filter = ["term", "term_option__option_type", "archived_at"]

    def get_term_option_type(self, obj):
        return obj.term_option.option_type

    get_term_option_type.short_description = "Term Option Type"
    get_term_option_type.admin_order_field = "term_option__option_type"


admin.site.register(Term, TermAdmin)
admin.site.register(Consent, ConsentAdmin)
{'fraction_non_alphanumeric': 0.10788973384030419, 'fraction_numerical': 0.0009505703422053232, 'mean_word_length': 4.496083550913838, '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': '3585213', 'n_tokens_mistral': 656, 'n_tokens_neox': 648, 'n_words': 129}