<commit_before>from django.contrib import admin

from mptt.admin import MPTTModelAdmin
from fsm_admin.mixins import FSMTransitionMixin

from .inlines import (
    AwardInline,
    CertificationInline,
    ContestInline,
    ContestantInline,
    SessionInline,
    PerformerInline,
    GroupInline,
    JudgeInline,
    MemberInline,
    PerformanceInline,
    ScoreInline,
    RoundInline,
    RoleInline,
    SongStackedInline,
    OrganizationInline,
    SubmissionInline,
)

from .models import (
    Award,
    Certification,
    Chapter,
    Chart,
    Contest,
    Contestant,
    Convention,
    Group,
    Judge,
    Member,
    Organization,
    Performance,
    Performer,
    Person,
    Role,
    Round,
    Score,
    Session,
    Submission,
    Song,
    User,
    Venue,
)

from super_inlines.admin import SuperModelAdmin


@admin.register(Award)
class AwardAdmin(admin.ModelAdmin):
    change_list_template = "admin/change_list_filter_sidebar.html"
    list_display = [
        'name',
        'status',
        'kind',
        'season',
        'size',
        'size_range',
        'scope',
        'scope_range',
        'is_improved',
        'is_novice',
        'idiom',
        'num_rounds',
        'stix_name',
    ]

    list_filter = [
        'status',
        'level',
        'kind',
        'season',
        'size',
        'scope',
        'organization',
        'is_primary',
        'is_novice',
        'is_improved',
    ]

    fields = [
        'name',
        'status',
        'organization',
        'level',
        'kind',
        'season',
        'size',
        'size_range',
        'scope',
        'scope_range',
        ('is_primary', 'is_improved', 'is_novice'),
        'idiom',
        'num_rounds',
        'cutoff',
        'minimum',
        # 'panel_size',
        'stix_num',
        'stix_name',
    ]

    readonly_fields = [
        'name',
        'level',
    ]


@admin.register(Certification)
class CertificationAdmin(admin.ModelAdmin):
    pass


@admin.register(Chart)
class ChartAdmin(admin.ModelAdmin):
    save_on_top = True
    search_fields = [
        'title',
    ]


@admin.register(Chapter)
class ChapterAdmin(admin.ModelAdmin):
    search_fields = (
        'name',
        'code',
    )

    list_display = (
        'name',
        'organization',
        'code',
        'status',
        'bhs_name',
        'bhs_group_name',
        'bhs_id',
        # 'location',
        # 'website',
        # 'facebook',
        # 'twitter',
        # 'email',
        # 'phone',
        # 'picture',<commit_msg>Complete Chart admin<commit_after>from django.contrib import admin

from mptt.admin import MPTTModelAdmin
from fsm_admin.mixins import FSMTransitionMixin

from .inlines import (
    AwardInline,
    CertificationInline,
    ContestInline,
    ContestantInline,
    SessionInline,
    PerformerInline,
    GroupInline,
    JudgeInline,
    MemberInline,
    PerformanceInline,
    ScoreInline,
    RoundInline,
    RoleInline,
    SongStackedInline,
    OrganizationInline,
    SubmissionInline,
)

from .models import (
    Award,
    Certification,
    Chapter,
    Chart,
    Contest,
    Contestant,
    Convention,
    Group,
    Judge,
    Member,
    Organization,
    Performance,
    Performer,
    Person,
    Role,
    Round,
    Score,
    Session,
    Submission,
    Song,
    User,
    Venue,
)

from super_inlines.admin import SuperModelAdmin


@admin.register(Award)
class AwardAdmin(admin.ModelAdmin):
    change_list_template = "admin/change_list_filter_sidebar.html"
    list_display = [
        'name',
        'status',
        'kind',
        'season',
        'size',
        'size_range',
        'scope',
        'scope_range',
        'is_improved',
        'is_novice',
        'idiom',
        'num_rounds',
        'stix_name',
    ]

    list_filter = [
        'status',
        'level',
        'kind',
        'season',
        'size',
        'scope',
        'organization',
        'is_primary',
        'is_novice',
        'is_improved',
    ]

    fields = [
        'name',
        'status',
        'organization',
        'level',
        'kind',
        'season',
        'size',
        'size_range',
        'scope',
        'scope_range',
        ('is_primary', 'is_improved', 'is_novice'),
        'idiom',
        'num_rounds',
        'cutoff',
        'minimum',
        # 'panel_size',
        'stix_num',
        'stix_name',
    ]

    readonly_fields = [
        'name',
        'level',
    ]


@admin.register(Certification)
class CertificationAdmin(admin.ModelAdmin):
    pass


@admin.register(Chart)
class ChartAdmin(admin.ModelAdmin):
    change_list_template = "admin/change_list_filter_sidebar.html"

    fields = [
        'name',
        'status',
        'title',
        'arranger',
        'composer',
        'lyricist',
        'bhs_id',
        ('is_medley', 'is_generic',),
    ]

    list_display = [
        'name',
        'status',
        'title',
        'arranger',
        'bhs_id',
    ]

    list_filter = [
        'status',
    ]

    readonly_fields = [
        'name',
    ]

    search_fields = [
        'title',
    ]


@admin.register(Chapter)
class ChapterAdmin(admin.ModelAdmin):
    search_fields = (
        'name',
        'code',
    )

    list_display = (
        'name',
        'organization',
        'code',
        'status',
        'bhs_name',
        'bhs_group_name',
        'bhs_id',
        # 'location',
        # 'website',
        # 'facebook',
        # 'twitter',
        # 'email',
        # 'phone',
        # 'picture',
{'fraction_non_alphanumeric': 0.12046263345195729, 'fraction_numerical': 0.0, 'mean_word_length': 1.7993027888446216, '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': '5492768', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1832, 'n_words': 313}