<commit_before>from django.contrib import admin
from boris.other.models import SyringeCollection


class SyringeCollectionAdmin(admin.ModelAdmin):

    raw_id_fields = ('town','persons',)
    autocomplete_lookup_fields = {
        'fk': ['town',],
        'm2m': ['persons',],
    }

    class Meta:
        model = SyringeCollection


admin.site.register(SyringeCollection, SyringeCollectionAdmin)<commit_msg>Make the list view of SyringeCollection admin nicer (refs #57).<commit_after># -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from boris.other.models import SyringeCollection

def user_list(self, obj):
    return u'<br />'.join([unicode(s) for s in obj.persons.all()])
user_list.short_description = _(u'Kdo')
user_list.allow_tags = True

class SyringeCollectionAdmin(admin.ModelAdmin):

    raw_id_fields = ('town','persons',)
    autocomplete_lookup_fields = {
        'fk': ['town',],
        'm2m': ['persons',],
    }
    list_display = ('date', 'town', 'location', 'count', 'user_list')
    list_filter = ('date', 'town',)

    class Meta:
        model = SyringeCollection

SyringeCollectionAdmin.user_list = user_list


admin.site.register(SyringeCollection, SyringeCollectionAdmin)
{'fraction_non_alphanumeric': 0.1305379746835443, 'fraction_numerical': 0.003955696202531646, 'mean_word_length': 4.315126050420168, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4697962', 'n_tokens_mistral': 402, 'n_tokens_neox': 385, 'n_words': 87}