<commit_before>from django.contrib import admin
from .models import Redirect


class RedirectAdmin(admin.ModelAdmin):
    list_display = ('old_path', 'new_path')
    search_fields = ('old_path', 'new_path')

admin.site.register(Redirect, RedirectAdmin)
<commit_msg>Add a 'test redirect' link to redirect admin.<commit_after>from django.contrib import admin
from django.utils.html import escape
from .models import Redirect


@admin.register(Redirect)
class RedirectAdmin(admin.ModelAdmin):
    list_display = ('old_path', 'new_path', 'test_redirect')
    search_fields = ('old_path', 'new_path')

    def test_redirect(self, obj):
        return '<a target="_blank" href="{}">Test</a>'.format(
            escape(obj.old_path)
        )

    test_redirect.allow_tags = True

{'fraction_non_alphanumeric': 0.12144702842377261, 'fraction_numerical': 0.0, 'mean_word_length': 4.575539568345324, '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': '3173424', 'n_tokens_mistral': 237, 'n_tokens_neox': 232, 'n_words': 57}