Files
offline-db/users/migrations/0032_seed_tv_addict_and_ova_enthusiast.py
google-labs-jules[bot] 097294943c feat(users): added TV Addict and OVA Enthusiast badges (#140)
- Added `TV Addict` badge (10 different TV series)
- Added `OVA Enthusiast` badge (5 different OVAs)
- Implemented logic in `ConsumptionBadgeStrategy`
- Added data migration and tests
- Current Focus Mode: C (The Architect)
- Changes Made: Modified `users/badge_system.py`, added migration, added tests.
- Impact on System: Users can now earn new badges based on content type consumption.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-01-23 11:27:42 +00:00

34 lines
971 B
Python

# Generated by Django 5.1.6 on 2026-01-22 20:27
from django.db import migrations
def seed_badges(apps, schema_editor):
Badge = apps.get_model('users', 'Badge')
Badge.objects.create(
slug='tv-addict',
name='TV Addict',
description='Watched 10 different TV Series.',
icon_url='https://example.com/badges/tv-addict.png'
)
Badge.objects.create(
slug='ova-enthusiast',
name='OVA Enthusiast',
description='Watched 5 different OVAs.',
icon_url='https://example.com/badges/ova-enthusiast.png'
)
def remove_badges(apps, schema_editor):
Badge = apps.get_model('users', 'Badge')
Badge.objects.filter(slug='tv-addict').delete()
Badge.objects.filter(slug='ova-enthusiast').delete()
class Migration(migrations.Migration):
dependencies = [
("users", "0031_seed_century_club_badge"),
]
operations = [
migrations.RunPython(seed_badges, remove_badges),
]