Like/dislike + report under every question and lesson, lesson reports and vote columns in admin; practice islands refresh from file; audit fixes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
46
content/migrations/0023_lesson_report_content_vote.py
Normal file
46
content/migrations/0023_lesson_report_content_vote.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# Generated by Django 5.2.17 on 2026-10-12 09:21
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('content', '0022_plain_math_messages_again'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ContentVote',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('kind', models.CharField(choices=[('question', 'سوال'), ('lesson', 'درس')], max_length=10)),
|
||||
('target_id', models.IntegerField()),
|
||||
('user_id', models.IntegerField()),
|
||||
('value', models.SmallIntegerField()),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
options={
|
||||
'indexes': [models.Index(fields=['kind', 'target_id'], name='content_con_kind_87301f_idx')],
|
||||
'constraints': [models.UniqueConstraint(fields=('kind', 'target_id', 'user_id'), name='one_vote_per_user_target')],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='LessonReport',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('user_id', models.IntegerField(db_index=True)),
|
||||
('reason', models.CharField(choices=[('wrong_content', 'مطلبِ درس اشتباه است'), ('unclear', 'توضیح گنگ است'), ('typo', 'غلطِ املایی/نگارشی'), ('bad_figure', 'شکل اشکال دارد'), ('other', 'موردِ دیگر')], default='other', max_length=20)),
|
||||
('note', models.TextField(blank=True)),
|
||||
('status', models.CharField(choices=[('open', 'باز'), ('resolved', 'بررسی\u200cشده'), ('rejected', 'رد شد')], db_index=True, default='open', max_length=15)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('resolved_at', models.DateTimeField(blank=True, null=True)),
|
||||
('lesson', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports', to='content.lesson')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['-created_at'],
|
||||
'indexes': [models.Index(fields=['lesson', 'status'], name='content_les_lesson__a6a0ce_idx')],
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user