mirror of
https://github.com/barkeser2002/offline-db.git
synced 2026-09-25 02:19:59 +03:00
- Implemented `Review` model in `content/models.py`. - Added API endpoints for reviews in `content/api/`. - Implemented "Critic" badge logic in `users/services.py` (awarded on first review). - Seeded "Critic" badge via migration. - Added comprehensive tests for reviews and badge awarding. - Fixed startup crash by adding `content/api/__init__.py`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
31 lines
841 B
Python
31 lines
841 B
Python
# Generated by Django 4.0.2 on 2024-03-05 12:00
|
|
|
|
from django.db import migrations
|
|
|
|
def seed_critic_badge(apps, schema_editor):
|
|
Badge = apps.get_model('users', 'Badge')
|
|
Badge.objects.get_or_create(
|
|
slug='critic',
|
|
defaults={
|
|
'name': 'Critic',
|
|
'description': 'Wrote your first review.',
|
|
'icon_url': '/static/badges/critic.png',
|
|
# 'points': 10 <-- Removed invalid field
|
|
}
|
|
)
|
|
|
|
def remove_critic_badge(apps, schema_editor):
|
|
Badge = apps.get_model('users', 'Badge')
|
|
Badge.objects.filter(slug='critic').delete()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('users', '0001_initial'),
|
|
('users', '0016_auto_20260121_0929'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(seed_critic_badge, remove_critic_badge),
|
|
]
|