<commit_before>from django.contrib import admin

from elo.models import UserProfile
from ladder.models import Match, Rank, Game, Challenge, Ladder

class MatchAdmin(admin.ModelAdmin):
    list_display = ('date_challenged', 'ladder', 'challenger_name', 'challengee_name', 'winner_name')
    list_filter = ['date_challenged']
    search_fields = ['challenger', 'challengee']

    def challenger_name(self, obj):
        up = UserProfile.objects.get(user=obj.challenger)
        return up.handle

    def challengee_name(self, obj):
        up = UserProfile.objects.get(user=obj.challengee)
        return up.handle

    def winner_name(self, obj):
        up = UserProfile.objects.get(user=obj.winner)
        return up.handle

class RankAdmin(admin.ModelAdmin):
    ordering = ('ladder', 'rank')
    #list_display = ('player_name', 'rank', 'arrow', 'game')
    #list_filter = ('game',)
    #def player_name(self, obj):
    #    up = UserProfile.objects.get(user=obj.player)
    #    return up.handle


class GameAdmin(admin.ModelAdmin):
    readonly_fields=('slug',)

admin.site.register(Match, MatchAdmin)
admin.site.register(Rank, RankAdmin)
admin.site.register(Game, GameAdmin)
admin.site.register(Ladder)<commit_msg>Added inline rankings to the ladder admin page<commit_after>from django.contrib import admin

from elo.models import UserProfile
from ladder.models import Match, Rank, Game, Challenge, Ladder

class RankInline( admin.TabularInline ) :
    model = Rank
    verbose_name_plural = "rankings"
    ordering = ('rank',)

class LadderAdmin( admin.ModelAdmin ) :
    inlines = [RankInline]
    list_display = ('__unicode__','created','end_date','players')

class MatchAdmin(admin.ModelAdmin):
    list_display = ('date_challenged', 'ladder', 'challenger_name', 'challengee_name', 'winner_name')
    list_filter = ['date_challenged']
    search_fields = ['challenger', 'challengee']

    def challenger_name(self, obj):
        up = UserProfile.objects.get(user=obj.challenger)
        return up.handle

    def challengee_name(self, obj):
        up = UserProfile.objects.get(user=obj.challengee)
        return up.handle

    def winner_name(self, obj):
        up = UserProfile.objects.get(user=obj.winner)
        return up.handle

class RankAdmin(admin.ModelAdmin):
    ordering = ('ladder', 'rank')
    #list_display = ('player_name', 'rank', 'arrow', 'game')
    #list_filter = ('game',)
    #def player_name(self, obj):
    #    up = UserProfile.objects.get(user=obj.player)
    #    return up.handle


class GameAdmin(admin.ModelAdmin):
    readonly_fields=('slug',)

admin.site.register(Match, MatchAdmin)
admin.site.register(Rank, RankAdmin)
admin.site.register(Game, GameAdmin)
admin.site.register(Ladder, LadderAdmin)
{'fraction_non_alphanumeric': 0.12846715328467154, 'fraction_numerical': 0.0, 'mean_word_length': 4.191287878787879, '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': '604074', 'n_tokens_mistral': 890, 'n_tokens_neox': 860, 'n_words': 181}