Files
offline-db/users/migrations/0014_seed_loyal_fan_badge.py
google-labs-jules[bot] c6b1ec793a feat(auto): implemented Loyal Fan badge (#92)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-01-21 06:40:12 +00:00

29 lines
868 B
Python

# Generated by Django
from django.db import migrations
def seed_loyal_fan_badge(apps, schema_editor):
Badge = apps.get_model('users', 'Badge')
Badge.objects.get_or_create(
slug='loyal-fan',
defaults={
'name': 'Loyal Fan',
'description': 'Watched 10 episodes of the same anime.',
# 'icon' field does not exist, uses 'icon_url' instead.
'icon_url': 'https://img.icons8.com/color/48/000000/heart-with-pulse.png'
}
)
def remove_loyal_fan_badge(apps, schema_editor):
Badge = apps.get_model('users', 'Badge')
Badge.objects.filter(slug='loyal-fan').delete()
class Migration(migrations.Migration):
dependencies = [
('users', '0013_seed_genre_explorer_badge'),
]
operations = [
migrations.RunPython(seed_loyal_fan_badge, remove_loyal_fan_badge),
]