<commit_before>from django.contrib.admin import site, ModelAdmin, StackedInline, TabularInline
from .models import Timeline, TimelineEvent, TimelineOptions, TimelinePost


class CommonMedia:
    js = (
        #'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
        #'admin/js/editor.js',
        'admin/js/inlinecollapsed.js',
    )
    css = {
        'all': ('admin/css/editor.css',),
    }


class OptionsInline(StackedInline):
    model = TimelineOptions


class EventsInline(StackedInline):
    model = TimelineEvent


class TimelinePostInline(TabularInline):
    model = TimelinePost
    fk_name = 'timeline'
    raw_id_fields = ['post']
    actions = None
    extra = 1


class TimelineAdmin(ModelAdmin):
    fieldsets = (
        (None, {'fields': (('headline', 'start_date'), 'text')}),
        ('Assets', {
            'classes': ('collapse',),
            'fields': ('asset_media', 'asset_credit', 'asset_caption')
        }),
        ('Source', {
            'classes': ('collapse',),
            'fields': ('source', 'json')
        })
    )
    inlines = [TimelinePostInline, OptionsInline, EventsInline]
    Media = CommonMedia


class TimelineEventAdmin(ModelAdmin):
    raw_id_fields = ('timeline',)


class TimelineOptionsAdmin(ModelAdmin):
    raw_id_fields = ('timeline',)

site.register(Timeline, TimelineAdmin)
site.register(TimelineEvent, TimelineEventAdmin)
site.register(TimelineOptions, TimelineOptionsAdmin)
<commit_msg>removed collapse from admin due to Django Suit compatibility<commit_after>from django.contrib.admin import site, ModelAdmin, StackedInline, TabularInline
from .models import Timeline, TimelineEvent, TimelineOptions, TimelinePost


class CommonMedia:
    js = (
        #'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
        #'admin/js/editor.js',
        'admin/js/inlinecollapsed.js',
    )
    css = {
        'all': ('admin/css/editor.css',),
    }


class OptionsInline(StackedInline):
    model = TimelineOptions


class EventsInline(StackedInline):
    model = TimelineEvent


class TimelinePostInline(TabularInline):
    model = TimelinePost
    fk_name = 'timeline'
    raw_id_fields = ['post']
    actions = None
    extra = 1


class TimelineAdmin(ModelAdmin):
    fieldsets = (
        (None, {'fields': (('headline', 'start_date'), 'text')}),
        ('Assets', {
            'classes': ('collapse',),
            'fields': ('asset_media', 'asset_credit', 'asset_caption')
        }),
        ('Source', {
            'classes': ('collapse',),
            'fields': ('source', 'json')
        })
    )
    inlines = [TimelinePostInline, OptionsInline, EventsInline]
    # Media = CommonMedia


class TimelineEventAdmin(ModelAdmin):
    raw_id_fields = ('timeline',)


class TimelineOptionsAdmin(ModelAdmin):
    raw_id_fields = ('timeline',)

site.register(Timeline, TimelineAdmin)
site.register(TimelineEvent, TimelineEventAdmin)
site.register(TimelineOptions, TimelineOptionsAdmin)

{'fraction_non_alphanumeric': 0.136926682289923, 'fraction_numerical': 0.002678272514228323, 'mean_word_length': 3.3304347826086955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2609839', 'n_tokens_mistral': 934, 'n_tokens_neox': 930, 'n_words': 176}