You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
538 B
19 lines
538 B
8 months ago
|
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
|