add gamification characters (Duolingo-style mascot catalog)
New progress.Character model: an admin-managed catalog (same pattern as subscription.Plan) of selectable mascots, each unlocked once the user's XP crosses unlock_xp. No separate ownership table yet — unlocking is a pure function of UserStats.xp, kept intentionally minimal since this is the first of an incremental rollout the senior asked for. - GET /api/characters — catalog with per-user unlocked/selected flags - POST /api/characters/select — picks an active character, rejecting ones the user hasn't unlocked yet - UserStats.selected_character_id tracks the pick - seed_test_data now seeds 4 sample characters (owl/fox/turtle/lion) for local/staging testing Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import ActiveDay, LeaderboardEntry, StreakRecord, UserHearts, UserStats
|
||||
from .models import ActiveDay, Character, LeaderboardEntry, StreakRecord, UserHearts, UserStats
|
||||
|
||||
|
||||
@admin.register(UserStats)
|
||||
class UserStatsAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'user_id', 'xp', 'coins', 'progress_percent')
|
||||
list_display = ('id', 'user_id', 'xp', 'coins', 'progress_percent', 'selected_character_id')
|
||||
|
||||
|
||||
@admin.register(Character)
|
||||
class CharacterAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'name', 'slug', 'icon', 'unlock_xp', 'order')
|
||||
ordering = ('order', 'unlock_xp')
|
||||
|
||||
|
||||
@admin.register(LeaderboardEntry)
|
||||
|
||||
Reference in New Issue
Block a user