<commit_before>from django.contrib import admin
from django import forms
from formfieldstash.admin import FormFieldStashMixin
from ckeditor_link.admin import DjangoLinkAdmin
from ckeditor_link.link_model.conf import CKEDITOR_LINK_TYPE_CHOICES, CKEDITOR_LINK_STYLE_CHOICES

from .models import Link


MY_CKEDITOR_LINK_TYPE_CHOICES = list(CKEDITOR_LINK_TYPE_CHOICES)
# MY_CKEDITOR_LINK_TYPE_CHOICES.append(
#     ('project', 'Project', )
# )


class LinkAdminForm(forms.ModelForm):
    link_type = forms.ChoiceField(
        required=False,
        choices=MY_CKEDITOR_LINK_TYPE_CHOICES,
        widget=forms.Select(
            attrs={
                'data-formfield-stash': 'true',
                'data-original-field': 'link_type',
            }
        )
    )
    link_style = forms.ChoiceField(
        required=False,
        choices=CKEDITOR_LINK_STYLE_CHOICES,
    )


class LinkAdmin(FormFieldStashMixin, DjangoLinkAdmin):
    form = LinkAdminForm
    single_formfield_stash = ('link_type', )

    # fix for page widget error! use with cms 3.3.1
    class Media:
        js = ('cms/js/dist/bundle.admin.base.min.js',)


admin.site.register(Link, LinkAdmin)<commit_msg>as default, add LogEntry to admin<commit_after>from django.contrib import admin
from django import forms
from django.contrib.admin.models import LogEntry
from formfieldstash.admin import FormFieldStashMixin
from ckeditor_link.admin import DjangoLinkAdmin
from ckeditor_link.link_model.conf import CKEDITOR_LINK_TYPE_CHOICES, CKEDITOR_LINK_STYLE_CHOICES

from .models import Link


MY_CKEDITOR_LINK_TYPE_CHOICES = list(CKEDITOR_LINK_TYPE_CHOICES)
# MY_CKEDITOR_LINK_TYPE_CHOICES.append(
#     ('project', 'Project', )
# )


class LinkAdminForm(forms.ModelForm):
    link_type = forms.ChoiceField(
        required=False,
        choices=MY_CKEDITOR_LINK_TYPE_CHOICES,
        widget=forms.Select(
            attrs={
                'data-formfield-stash': 'true',
                'data-original-field': 'link_type',
            }
        )
    )
    link_style = forms.ChoiceField(
        required=False,
        choices=CKEDITOR_LINK_STYLE_CHOICES,
    )


@admin.register(Link)
class LinkAdmin(FormFieldStashMixin, DjangoLinkAdmin):
    form = LinkAdminForm
    single_formfield_stash = ('link_type', )

    # fix for page widget error! use with cms 3.3.1
    class Media:
        js = ('cms/js/dist/bundle.admin.base.min.js',)


@admin.register(LogEntry)
class LogEntryAdmin(admin.ModelAdmin):
    pass
{'fraction_non_alphanumeric': 0.08816425120772947, 'fraction_numerical': 0.0024154589371980675, 'mean_word_length': 3.461400359066427, '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': '5293594', 'n_tokens_mistral': 835, 'n_tokens_neox': 795, 'n_words': 147}