<commit_before>from django.contrib import admin
from django.conf import settings

from icekit.utils.admin.mixins import ThumbnailAdminMixin

from . import models


class ImageAdmin(ThumbnailAdminMixin, admin.ModelAdmin):
    list_display = ['thumbnail', 'title', 'alt_text',]
    list_display_links = ['alt_text', 'thumbnail']
    filter_horizontal = ['categories', ]
    list_filter = ['categories',]
    search_fields = ['title', 'alt_text', 'caption', 'admin_notes', 'image']

    change_form_template = 'image/admin/change_form.html'

    # ThumbnailAdminMixin attributes
    thumbnail_field = 'image'
    thumbnail_options = settings.THUMBNAIL_ALIASES['']['admin']

admin.site.register(models.Image, ImageAdmin)
<commit_msg>Don't require THUMBNAIL_ALIASES to be set.<commit_after>from django.contrib import admin
from django.conf import settings

from icekit.utils.admin.mixins import ThumbnailAdminMixin

from . import models

try:
    ADMIN_THUMB_ALIAS = settings.THUMBNAIL_ALIASES['']['admin']
except (AttributeError, KeyError):
    ADMIN_THUMB_ALIAS = {'size': (150, 150)}

class ImageAdmin(ThumbnailAdminMixin, admin.ModelAdmin):
    list_display = ['thumbnail', 'title', 'alt_text',]
    list_display_links = ['alt_text', 'thumbnail']
    filter_horizontal = ['categories', ]
    list_filter = ['categories',]
    search_fields = ['title', 'alt_text', 'caption', 'admin_notes', 'image']

    change_form_template = 'image/admin/change_form.html'

    # ThumbnailAdminMixin attributes
    thumbnail_field = 'image'
    thumbnail_options = ADMIN_THUMB_ALIAS

admin.site.register(models.Image, ImageAdmin)

{'fraction_non_alphanumeric': 0.120817843866171, 'fraction_numerical': 0.0037174721189591076, 'mean_word_length': 5.383399209486166, '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': '217486', 'n_tokens_mistral': 533, 'n_tokens_neox': 518, 'n_words': 105}