<commit_before>from django.contrib import admin
from django.db import models
from django.forms import (
    widgets,
)

from django_object_actions import (
    DjangoObjectActions,
    takes_instance_or_queryset,
)

from easy_select2 import select2_modelform

from .models import (
    Convention,
    Contest,
    Contestant,
    Group,
    District,
    Song,
    Person,
    Performance,
    Score,
    Judge,
    Singer,
    Director,
    Session,
    # Catalog,
    Award,
    Appearance,
    User,
)

from grappelli.forms import GrappelliSortableHiddenMixin


@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    model = User
    save_on_top = True


class PerformancesInline(admin.TabularInline):
    form = select2_modelform(
        Performance,
        attrs={'width': '100px'},
    )
    fields = (
        'appearance',
        'order',
        'song',
        'mus_points',
        'prs_points',
        'sng_points',
    )
    ordering = (
        'appearance',
        'order',
    )
    model = Performance
    extra = 0
    raw_id_fields = (
        'appearance',
        'song',
    )
    can_delete = True
    show_change_link = True


class ScoresInline(admin.TabularInline):
    model = Score
    form = select2_modelform(
        Score,
        attrs={'width': '300px'},
    )
    fields = (
        'performance',
        'judge',
        'category',
        'points',
    )
    ordering = (
        'judge',
    )
    extra = 0
    raw_id_fields = (
        'judge',
    )
    can_delete = True
    show_change_link = True


class JudgesInline(admin.TabularInline):
    model = Judge
    form = select2_modelform(
        Judge,
        attrs={'width': '200px'},
    )
    fields = (
        'contest',
        'person',
        'district',
        'category',
        'slot',
        # 'is_practice',
    )
    ordering = (
        'category',
        'slot',
    )
    extra = 0
    raw_id_fields = (
        'person',
        'contest',
    )
    can_delete = True
    show_change_link = True
    readonly_fields = [
        'person',
    ]
    classes = ('grp-collapse grp-closed',)


class SingersInline(admin.TabularInline):
    model = Singer
    form = select2_modelform(<commit_msg>Remove readonly restriction on inline<commit_after>from django.contrib import admin
from django.db import models
from django.forms import (
    widgets,
)

from django_object_actions import (
    DjangoObjectActions,
    takes_instance_or_queryset,
)

from easy_select2 import select2_modelform

from .models import (
    Convention,
    Contest,
    Contestant,
    Group,
    District,
    Song,
    Person,
    Performance,
    Score,
    Judge,
    Singer,
    Director,
    Session,
    # Catalog,
    Award,
    Appearance,
    User,
)

from grappelli.forms import GrappelliSortableHiddenMixin


@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    model = User
    save_on_top = True


class PerformancesInline(admin.TabularInline):
    form = select2_modelform(
        Performance,
        attrs={'width': '100px'},
    )
    fields = (
        'appearance',
        'order',
        'song',
        'mus_points',
        'prs_points',
        'sng_points',
    )
    ordering = (
        'appearance',
        'order',
    )
    model = Performance
    extra = 0
    raw_id_fields = (
        'appearance',
        'song',
    )
    can_delete = True
    show_change_link = True


class ScoresInline(admin.TabularInline):
    model = Score
    form = select2_modelform(
        Score,
        attrs={'width': '300px'},
    )
    fields = (
        'performance',
        'judge',
        'category',
        'points',
    )
    ordering = (
        'judge',
    )
    extra = 0
    raw_id_fields = (
        'judge',
    )
    can_delete = True
    show_change_link = True


class JudgesInline(admin.TabularInline):
    model = Judge
    form = select2_modelform(
        Judge,
        attrs={'width': '200px'},
    )
    fields = (
        'contest',
        'person',
        'district',
        'category',
        'slot',
        # 'is_practice',
    )
    ordering = (
        'category',
        'slot',
    )
    extra = 0
    raw_id_fields = (
        'person',
        'contest',
    )
    can_delete = True
    show_change_link = True
    classes = ('grp-collapse grp-closed',)


class SingersInline(admin.TabularInline):
    model = Singer
    form = select2_modelform(
{'fraction_non_alphanumeric': 0.10492989597467209, 'fraction_numerical': 0.008141112618724558, 'mean_word_length': 1.9966124661246611, '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': '4479970', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1406, 'n_words': 287}