mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-08 16:38:54 -05:00
ref
This commit is contained in:
parent
cf6d9ae065
commit
52fab13286
@ -28,6 +28,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def disable_signal(signal, receiver, sender):
|
def disable_signal(signal, receiver, sender):
|
||||||
|
"""Context manager to temporarily disable a signal"""
|
||||||
signal.disconnect(receiver, sender=sender)
|
signal.disconnect(receiver, sender=sender)
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
|
|||||||
@ -389,6 +389,7 @@ class Media(models.Model):
|
|||||||
Update SearchVector field of SearchModel using raw SQL
|
Update SearchVector field of SearchModel using raw SQL
|
||||||
search field is used to store SearchVector
|
search field is used to store SearchVector
|
||||||
"""
|
"""
|
||||||
|
|
||||||
db_table = self._meta.db_table
|
db_table = self._meta.db_table
|
||||||
|
|
||||||
# first get anything interesting out of the media
|
# first get anything interesting out of the media
|
||||||
@ -640,7 +641,7 @@ class Media(models.Model):
|
|||||||
else:
|
else:
|
||||||
self.preview_file_path = encoding.media_file.path
|
self.preview_file_path = encoding.media_file.path
|
||||||
|
|
||||||
self.save(update_fields=["encoding_status", "listable", "listable", "preview_file_path"])
|
self.save(update_fields=["encoding_status", "listable", "preview_file_path"])
|
||||||
|
|
||||||
if encoding and encoding.status == "success" and encoding.profile.codec == "h264" and action == "add" and not encoding.chunk:
|
if encoding and encoding.status == "success" and encoding.profile.codec == "h264" and action == "add" and not encoding.chunk:
|
||||||
from . import tasks
|
from . import tasks
|
||||||
@ -1573,7 +1574,9 @@ def media_save(sender, instance, created, **kwargs):
|
|||||||
# once model is saved
|
# once model is saved
|
||||||
# SOS: do not put anything here, as if more logic is added,
|
# SOS: do not put anything here, as if more logic is added,
|
||||||
# we have to disconnect signal to avoid infinite recursion
|
# we have to disconnect signal to avoid infinite recursion
|
||||||
print(f'kalesate {media_save}')
|
if not instance.friendly_token:
|
||||||
|
return False
|
||||||
|
|
||||||
if created:
|
if created:
|
||||||
from .methods import notify_users
|
from .methods import notify_users
|
||||||
|
|
||||||
@ -1592,7 +1595,7 @@ def media_save(sender, instance, created, **kwargs):
|
|||||||
tag.update_tag_media()
|
tag.update_tag_media()
|
||||||
|
|
||||||
instance.update_search_vector()
|
instance.update_search_vector()
|
||||||
print(f'kanei exit i kalesate {media_save}')
|
print(f'kanei exit i media_save')
|
||||||
|
|
||||||
|
|
||||||
@receiver(pre_delete, sender=Media)
|
@receiver(pre_delete, sender=Media)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user