from django.contrib import admin from main.models import News, HelpCategory, Faq from qc.admin import admin_site class NewsAdmin(admin.ModelAdmin): list_display = ('title', 'is_published', 'published_date') class HelpCategoryAdmin(admin.ModelAdmin): list_display = ('order_number', 'title') class FaqAdmin(admin.ModelAdmin): list_display = ('question', 'category') list_filter = ('category', ) admin_site.register(News, NewsAdmin) admin_site.register(HelpCategory, HelpCategoryAdmin) admin_site.register(Faq, FaqAdmin)
class CurrentMissionAdmin(admin.ModelAdmin): list_display = ('player', 'get_quest', 'mission', 'start_time') ordering = ['-mission', 'start_time'] list_filter = ('mission__quest', ) class KeylogAdmin(admin.ModelAdmin): list_display = ('player', 'get_quest', 'mission', 'key', 'fix_time', 'is_right', 'points') ordering = ['fix_time'] list_filter = ('is_right', 'player', 'mission', 'mission__quest') class MessageAdmin(admin.ModelAdmin): list_display = ('strip_text', 'is_show') list_filter = ('quest', ) def get_quest(self, obj): return obj.mission.quest get_quest.short_description = 'квест' CurrentMissionAdmin.get_quest = get_quest KeylogAdmin.get_quest = get_quest admin_site.register(Quest, QuestAdmin) admin_site.register(Membership, MemberAdmin) admin_site.register(Mission, MissionAdmin) admin_site.register(CurrentMission, CurrentMissionAdmin) admin_site.register(Keylog, KeylogAdmin) admin_site.register(Message, MessageAdmin)