<commit_before>from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from hr.models import Application, Recommendation, Audit, Blacklist, BlacklistSource

class ApplicationAdmin(admin.ModelAdmin):
    list_display = ('user', 'character', 'corporation', 'status', 'recommendations')
    search_fields = ['user', 'character', 'status']
    list_filter = ('status',)

    def recommendations(self, obj):
        return obj.recommendation_set.all().count()

    recommendations.short_description = '# of Recommendations'

    def save_model(self, request, obj, form, change):
        obj.save(user=request.user)

admin.site.register(Application, ApplicationAdmin)

class RecommendationAdmin(admin.ModelAdmin):
    list_display = ('user', 'user_character', 'application')
    search_fields = ['user_character']

admin.site.register(Recommendation, RecommendationAdmin)

class AuditAdmin(admin.ModelAdmin):
    list_display = ('application', 'event', 'date')
    list_filter = ('event',)

admin.site.register(Audit, AuditAdmin)

class BlacklistAdmin(admin.ModelAdmin):
    list_display = ('type', 'value', 'source', 'created_date', 'created_by')
    list_filter = ('source', 'type')
    search_fields = ('value')

admin.site.register(Blacklist, BlacklistAdmin)

class BlacklistSourceAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')<commit_msg>Fix assumption in admin.py, works fine on 2.6 but errors on 2.5<commit_after>from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from hr.models import Application, Recommendation, Audit, Blacklist, BlacklistSource

class ApplicationAdmin(admin.ModelAdmin):
    list_display = ('user', 'character', 'corporation', 'status', 'recommendations')
    search_fields = ['user', 'character', 'status']
    list_filter = ('status',)

    def recommendations(self, obj):
        return obj.recommendation_set.all().count()

    recommendations.short_description = '# of Recommendations'

    def save_model(self, request, obj, form, change):
        obj.save(user=request.user)

admin.site.register(Application, ApplicationAdmin)

class RecommendationAdmin(admin.ModelAdmin):
    list_display = ('user', 'user_character', 'application')
    search_fields = ['user_character']

admin.site.register(Recommendation, RecommendationAdmin)

class AuditAdmin(admin.ModelAdmin):
    list_display = ('application', 'event', 'date')
    list_filter = ('event',)

admin.site.register(Audit, AuditAdmin)

class BlacklistAdmin(admin.ModelAdmin):
    list_display = ('type', 'value', 'source', 'created_date', 'created_by')
    list_filter = ('source', 'type')
    search_fields = ('value',)

admin.site.register(Blacklist, BlacklistAdmin)

class BlacklistSourceAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')
{'fraction_non_alphanumeric': 0.1319709040526498, 'fraction_numerical': 0.0013855213023900243, 'mean_word_length': 5.519187358916478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1241573', 'n_tokens_mistral': 856, 'n_tokens_neox': 827, 'n_words': 192}