from models import Achievement, Category, CollectionAchievement, Progress, ProgressAchievement, Task, TaskAchievement, TaskProgress, Trophies, UserAchievement
from django.contrib import admin
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.db import models

class CategoryAdmin(admin.ModelAdmin):
    list_display=['name', 'parent_category']
    search_fields = ('name', 'parent_category')

class AchievementAdmin(admin.ModelAdmin):
    list_display=['name', 'description', 'category']
    search_fields = ('name', 'category')

class ProgressAchievementAdmin(admin.ModelAdmin):
    list_display=['name', 'description', 'category']
    search_fields = ('name', 'category')

class TaskAchievementAdmin(admin.ModelAdmin):
    list_display=['name', 'description', 'category']
    search_fields = ('name', 'category')
    formfield_overrides = {
        models.ManyToManyField: {'widget': FilteredSelectMultiple("tasks", False)}
    }

class CollectionAchievementAdmin(admin.ModelAdmin):
    list_display=['name', 'description', 'category']
    search_fields = ('name', 'category')
    formfield_overrides = {
        models.ManyToManyField: {'widget': FilteredSelectMultiple("achievements", False)}
    }

class TaskAdmin(admin.ModelAdmin):
    list_display=['name', 'description']

@@ -1299,8 +1299,469 @@
 ption'%5D%0A
+%0Aadmin.site.register(Achievement, AchievementAdmin)%0Aadmin.site.register(Category, CategoryAdmin)%0Aadmin.site.register(ProgressAchievement, ProgressAchievementAdmin)%0Aadmin.site.register(Progress)%0Aadmin.site.register(TaskAchievement, TaskAchievementAdmin)%0Aadmin.site.register(Task, TaskAdmin)%0Aadmin.site.register(TaskProgress)%0Aadmin.site.register(Trophies)%0Aadmin.site.register(UserAchievement)%0Aadmin.site.register(CollectionAchievement, CollectionAchievementAdmin)

add register