mirror of
https://github.com/barkeser2002/offline-db.git
synced 2026-09-25 06:00:11 +03:00
Current Focus Mode: C (The Architect) Changes Made: - Added `type` field to `Anime` model (TV, Movie, OVA, etc.) with a default of 'TV'. - Created a data migration to seed the "Movie Buff" badge. - Implemented badge logic in `users/services.py` to award the badge when a user watches 5 different movies. - Added comprehensive unit tests in `users/tests/test_movie_buff_badge.py`. Impact on System: - Users can now track and be rewarded for watching anime movies. - The `Anime` model is more descriptive, allowing for better filtering and categorization in the future. - DB Schema updated for `content_anime` table. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
27 lines
776 B
Python
27 lines
776 B
Python
# Generated by Django 5.1.6 on 2026-01-22 20:27
|
|
|
|
from django.db import migrations
|
|
|
|
def seed_movie_buff_badge(apps, schema_editor):
|
|
Badge = apps.get_model('users', 'Badge')
|
|
Badge.objects.create(
|
|
slug='movie-buff',
|
|
name='Movie Buff',
|
|
description='Watched 5 different anime movies.',
|
|
icon_url='https://example.com/badges/movie-buff.png' # Placeholder URL
|
|
)
|
|
|
|
def remove_movie_buff_badge(apps, schema_editor):
|
|
Badge = apps.get_model('users', 'Badge')
|
|
Badge.objects.filter(slug='movie-buff').delete()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("users", "0025_seed_pilot_connoisseur_badge"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(seed_movie_buff_badge, remove_movie_buff_badge),
|
|
]
|