Commit 2896d99a authored by Ilya Simonov's avatar Ilya Simonov

fix add video to dynamic playlist

parent c874faa8
from django.conf import settings from django.conf import settings
from django.dispatch import receiver from django.dispatch import receiver
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.contrib.contenttypes.models import ContentType
from . import models, tasks, utils from . import models, tasks, utils
...@@ -18,5 +19,12 @@ def post_save_playlist(sender, instance, created, **kwargs): ...@@ -18,5 +19,12 @@ def post_save_playlist(sender, instance, created, **kwargs):
instance.mrss = f'{settings.DOMAIN_NAME}/api/playlist/{instance.id}/mrss' instance.mrss = f'{settings.DOMAIN_NAME}/api/playlist/{instance.id}/mrss'
instance.save() instance.save()
if instance.type == models.DYNAMIC:
utils.add_video_to_new_playlist(instance) @receiver(post_save, sender=models.TagToObject)
def post_save_tags(sender, instance, created, **kwargs):
if created:
playlist_content_type = ContentType.objects.get_for_model(models.Playlist)
if instance.content_type == playlist_content_type:
playlist = models.Playlist.objects.get(id=instance.object_id)
if playlist.type == models.DYNAMIC:
utils.add_video_to_new_playlist(playlist)
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