<commit_before># -*- encoding: utf-8 -*-
from django.contrib import admin
from django.db import models

from pagedown.widgets import AdminPagedownWidget

from .models import Promotion, Student, StudentApplication, StudentApplicationSetup


class StudentAdmin(admin.ModelAdmin):
    list_display = ('artist', 'number', 'promotion', 'graduate')
    search_fields = ('number', 'user__first_name', 'user__last_name')

    formfield_overrides = {
        models.TextField: {'widget': AdminPagedownWidget},
    }


class StudentApplicationAdmin(admin.ModelAdmin):
    search_fields = ['artist__user__first_name', 'artist__user__last_name', ]

    def _get_name(self, obj):
        return obj.artist.user.get_full_name()

    _get_name.short_description = "Nom"
    list_display = (
        'campaign',
        '_get_name',
        'current_year_application_count',
        'selected_for_interview',
        'selected',
        'remark',
    )


class StudentApplicationSetupAdmin(admin.ModelAdmin):

    def _get_name(self, obj):
        return obj.artist.user.get_full_name()

    list_display = (
        'name',<commit_msg>fix(studentapp): admin crash when user is deleted<commit_after># -*- encoding: utf-8 -*-
from django.contrib import admin
from django.db import models

from pagedown.widgets import AdminPagedownWidget

from .models import Promotion, Student, StudentApplication, StudentApplicationSetup


class StudentAdmin(admin.ModelAdmin):
    list_display = ('artist', 'number', 'promotion', 'graduate')
    search_fields = ('number', 'user__first_name', 'user__last_name')

    formfield_overrides = {
        models.TextField: {'widget': AdminPagedownWidget},
    }


class StudentApplicationAdmin(admin.ModelAdmin):
    search_fields = ['artist__user__first_name', 'artist__user__last_name', ]

    def _get_name(self, obj):
        if obj.artist:
            return obj.artist.user.get_full_name()

    _get_name.short_description = "Nom"
    list_display = (
        'campaign',
        '_get_name',
        'current_year_application_count',
        'selected_for_interview',
        'selected',
        'remark',
    )


class StudentApplicationSetupAdmin(admin.ModelAdmin):

    def _get_name(self, obj):
        return obj.artist.user.get_full_name()

    list_display = (
        'name',
{'fraction_non_alphanumeric': 0.10985670864090318, 'fraction_numerical': 0.0008684324793747286, 'mean_word_length': 3.6639676113360324, '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': '2797331', 'n_tokens_mistral': 699, 'n_tokens_neox': 678, 'n_words': 137}