Adds models, tasks, signal handlers and api's for adding, updating and deleting upstream->downstream links in database.
94 lines
4.2 KiB
Python
94 lines
4.2 KiB
Python
# Generated by Django 4.2.18 on 2025-02-05 05:33
|
|
|
|
import uuid
|
|
|
|
import django.db.models.deletion
|
|
import opaque_keys.edx.django.models
|
|
import openedx_learning.lib.fields
|
|
import openedx_learning.lib.validators
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('oel_publishing', '0002_alter_learningpackage_key_and_more'),
|
|
('contentstore', '0008_cleanstalecertificateavailabilitydatesconfig'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='LearningContextLinksStatus',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
(
|
|
'context_key',
|
|
opaque_keys.edx.django.models.CourseKeyField(
|
|
help_text='Linking status for course context key', max_length=255, unique=True
|
|
),
|
|
),
|
|
(
|
|
'status',
|
|
models.CharField(
|
|
choices=[
|
|
('pending', 'Pending'),
|
|
('processing', 'Processing'),
|
|
('failed', 'Failed'),
|
|
('completed', 'Completed'),
|
|
],
|
|
help_text='Status of links in given learning context/course.',
|
|
max_length=20,
|
|
),
|
|
),
|
|
('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])),
|
|
('updated', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])),
|
|
],
|
|
options={
|
|
'verbose_name': 'Learning Context Links status',
|
|
'verbose_name_plural': 'Learning Context Links status',
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='PublishableEntityLink',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')),
|
|
(
|
|
'upstream_usage_key',
|
|
opaque_keys.edx.django.models.UsageKeyField(
|
|
help_text='Upstream block usage key, this value cannot be null and useful to track upstream library blocks that do not exist yet',
|
|
max_length=255,
|
|
),
|
|
),
|
|
(
|
|
'upstream_context_key',
|
|
openedx_learning.lib.fields.MultiCollationCharField(
|
|
db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'},
|
|
db_index=True,
|
|
help_text='Upstream context key i.e., learning_package/library key',
|
|
max_length=500,
|
|
),
|
|
),
|
|
('downstream_usage_key', opaque_keys.edx.django.models.UsageKeyField(max_length=255, unique=True)),
|
|
('downstream_context_key', opaque_keys.edx.django.models.CourseKeyField(db_index=True, max_length=255)),
|
|
('version_synced', models.IntegerField()),
|
|
('version_declined', models.IntegerField(blank=True, null=True)),
|
|
('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])),
|
|
('updated', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])),
|
|
(
|
|
'upstream_block',
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name='links',
|
|
to='oel_publishing.publishableentity',
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
'verbose_name': 'Publishable Entity Link',
|
|
'verbose_name_plural': 'Publishable Entity Links',
|
|
},
|
|
),
|
|
]
|