<commit_before>from django.contrib import admin
from models import Person
from models import Maker
from models import MuseumStaff
from models import Client
from common.adminactions import merge_selected


class PersonAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'comments',)
    search_fields = ['name', 'comments']
    filter_horizontal = ['related_documents']
    actions = [merge_selected]
admin.site.register(Person, PersonAdmin)


class MakerAdmin(admin.ModelAdmin):
    list_display = ('name', 'comment')
    search_fields = ('name', 'comment')
admin.site.register(Maker, MakerAdmin)


admin.site.register(Client)


class MuseumStaffAdmin(admin.ModelAdmin):
    list_display = ('name', 'comments')
    search_fields = ('name', 'comments')<commit_msg>Clean up list of related_documents in person admin<commit_after>from django.contrib import admin
from models import Person
from models import Maker
from models import MuseumStaff
from models import Client
from cat.admin import MediaFileInline
from django.core import urlresolvers
from common.adminactions import merge_selected


class DocumentInline(MediaFileInline):
    model = Person.related_documents.through
    fields = ('document_link',)
    readonly_fields = ('document_link',)

    def document_link(self, obj):
        try:
            doc = obj.document.document
            admin_url = urlresolvers.reverse('admin:mediaman_document_change', args=(doc.id,))
            return '<a href="%s">%s</a>' % (admin_url, doc.name)
        except:
            return ''
    document_link.allow_tags = True
    verbose_name_plural = 'Related documents'


class PersonAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'comments',)
    search_fields = ['name', 'comments']
    fields = ('name', 'display_name', 'comments')
    inlines = [DocumentInline]
    actions = [merge_selected]
admin.site.register(Person, PersonAdmin)


class MakerAdmin(admin.ModelAdmin):
    list_display = ('name', 'comment')
    search_fields = ('name', 'comment')
admin.site.register(Maker, MakerAdmin)


admin.site.register(Client)


class MuseumStaffAdmin(admin.ModelAdmin):
    list_display = ('name', 'comments')
    search_fields = ('name', 'comments')
{'fraction_non_alphanumeric': 0.11607949412827462, 'fraction_numerical': 0.0, 'mean_word_length': 4.579345088161209, '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': '572459', 'n_tokens_mistral': 641, 'n_tokens_neox': 618, 'n_words': 163}