from cms import promoters from cms.models import Article from celery import shared_task @shared_task def promote_post(article_id): article = Article.objects.get(id=article_id) article.is_published = True article.save() marketer = promoters.Marketer(article) marketer.promote() @shared_task def delayed_post(article_id, publication_time): article = Article.objects.get(id=article_id) celery_task = promote_post.apply_async(args=[article.id], eta=publication_time) return celery_task.id