mirror of
https://github.com/barkeser2002/offline-db.git
synced 2026-09-25 04:00:02 +03:00
- 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>
34 lines
971 B
Python
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),
|
|
]
|