Commit 555f4d58 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Add scheduling module

parent f1141e45
from django.apps import AppConfig
class CoursesSchedulingConfig(AppConfig):
name = 'courses.scheduling'
# Generated by Django 2.2.24 on 2021-12-07 11:48
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
operations = [
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('task_id', models.IntegerField()),
('release_date', models.DateTimeField(blank=True, default=None, null=True, verbose_name='Date')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
'verbose_name': 'ScheduledTask',
'verbose_name_plural': 'ScheduledTasks',
from django.db import models
from django.conf import settings
from django.urls import reverse_lazy
from courses.models import Lesson, Unit
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.fields import GenericRelation
class ScheduledTask(models.Model):
class Meta:
verbose_name = _('ScheduledTask')
verbose_name_plural = _('ScheduledTasks')
task_id = models.IntegerField()
notes = GenericRelation(Lesson, Unit,)
release_date = models.DateTimeField(
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
......@@ -16,4 +16,4 @@ def lesson_created_or_updated(sender, instance: Lesson, **kwargs):
@receiver(pre_save, sender=Unit)
def unit_created_or_updated(sender, instance: Unit, **kwargs):
previous_unit = Unit.objects.get(
publish_unit.apply_async(args=[], eta=instance.release_date)
#publish_unit.apply_async(args=[], eta=instance.release_date)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment