Files
offline-db/users/migrations/0030_seed_otaku_badge.py
google-labs-jules[bot] 8e574c0b1c feat(auto): implemented Otaku badge (#132)
- Added migration to seed 'Otaku' badge
- Implemented logic in `users/services.py` to award the badge for completing 5 anime series
- Added tests in `users/tests/test_otaku_badge.py`
- Optimized DB queries to avoid N+1 issue

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

25 lines
608 B
Python

# Generated by Django 5.1.6 on 2026-01-23 00:00
from django.db import migrations
def seed_otaku_badge(apps, schema_editor):
Badge = apps.get_model('users', 'Badge')
Badge.objects.get_or_create(
slug='otaku',
defaults={
'name': 'Otaku',
'description': 'Completed 5 different anime series.',
'icon_url': '/static/badges/otaku.png'
}
)
class Migration(migrations.Migration):
dependencies = [
('users', '0029_seed_review_guru_and_star_power'),
]
operations = [
migrations.RunPython(seed_otaku_badge),
]