<commit_before>from django.contrib import admin
from django.contrib.contenttypes.generic import GenericTabularInline

from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.admin import AdminImageMixin

from pombola.images import models






class ImageAdmin(AdminImageMixin, admin.ModelAdmin):
    list_display = [ 'thumbnail', 'content_object', 'is_primary', 'source',  ]
    
    def thumbnail(self, obj):
        im = get_thumbnail(obj.image, '100x100')
        return '<img src="%s" />' % ( im.url )
    thumbnail.allow_tags = True


class ImageAdminInline(AdminImageMixin, GenericTabularInline):
    model        = models.Image
    extra        = 0
    can_delete   = False

admin.site.register( models.Image, ImageAdmin )<commit_msg>Allow image deletion from the inline admin<commit_after>from django.contrib import admin
from django.contrib.contenttypes.generic import GenericTabularInline

from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.admin import AdminImageMixin

from pombola.images import models






class ImageAdmin(AdminImageMixin, admin.ModelAdmin):
    list_display = [ 'thumbnail', 'content_object', 'is_primary', 'source',  ]

    def thumbnail(self, obj):
        im = get_thumbnail(obj.image, '100x100')
        return '<img src="%s" />' % ( im.url )
    thumbnail.allow_tags = True


class ImageAdminInline(AdminImageMixin, GenericTabularInline):
    model        = models.Image
    extra        = 0
    can_delete   = True

admin.site.register( models.Image, ImageAdmin )
{'fraction_non_alphanumeric': 0.09354413702239789, 'fraction_numerical': 0.00922266139657444, 'mean_word_length': 3.8842443729903535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2607784', 'n_tokens_mistral': 469, 'n_tokens_neox': 452, 'n_words': 110}