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

from django import forms
from django.db import models

from .models import (Badge, Award, Progress)


UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL',
    '%suploads/' % getattr(settings, 'MEDIA_URL', '/media/'))


def show_unicode(obj):
    return unicode(obj)
show_unicode.short_description = "Display"


def show_image(obj):
    img_url = "%s%s" % (UPLOADS_URL, obj.image)
    return ('<a href="%s" target="_new"><img src="%s" width="64" height="64" /></a>' % 
        (img_url, img_url))
show_image.allow_tags = True
show_image.short_description = "Image"


class BadgerAdmin(admin.ModelAdmin):

    list_display = ("title", "slug", "unique", "creator", show_image, "created", )

    filter_horizontal = ('prerequisites', )

    formfield_overrides = {
        models.ManyToManyField: {
            "widget": forms.widgets.SelectMultiple(attrs={"size": 25})
        }
    }


class AwardAdmin(admin.ModelAdmin):

    list_display = (show_unicode, 'badge', 'user', 'creator', show_image, 'created', )
<commit_msg>Tweak admin images from 64x64 to 48x48<commit_after>from django.conf import settings
from django.contrib import admin

from django import forms
from django.db import models

from .models import (Badge, Award, Progress)


UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL',
    '%suploads/' % getattr(settings, 'MEDIA_URL', '/media/'))


def show_unicode(obj):
    return unicode(obj)
show_unicode.short_description = "Display"


def show_image(obj):
    img_url = "%s%s" % (UPLOADS_URL, obj.image)
    return ('<a href="%s" target="_new"><img src="%s" width="48" height="48" /></a>' % 
        (img_url, img_url))
show_image.allow_tags = True
show_image.short_description = "Image"


class BadgerAdmin(admin.ModelAdmin):

    list_display = ("title", "slug", "unique", "creator", show_image, "created", )

    filter_horizontal = ('prerequisites', )

    formfield_overrides = {
        models.ManyToManyField: {
            "widget": forms.widgets.SelectMultiple(attrs={"size": 25})
        }
    }


class AwardAdmin(admin.ModelAdmin):

    list_display = (show_unicode, 'badge', 'user', 'creator', show_image, 'created', )

{'fraction_non_alphanumeric': 0.14701927386822053, 'fraction_numerical': 0.008964589870013447, 'mean_word_length': 4.326968973747016, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 9, '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': '5652324', 'n_tokens_mistral': 774, 'n_tokens_neox': 737, 'n_words': 166}