From edbeb4c4b7fe71c08d1aa4c9091bedd0c93a66f1 Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Wed, 17 May 2023 17:39:51 +0200 Subject: [PATCH] add signal to advance repos on creation --- scipost_django/production/models.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scipost_django/production/models.py b/scipost_django/production/models.py index 87868c360..3f4d7881d 100644 --- a/scipost_django/production/models.py +++ b/scipost_django/production/models.py @@ -351,7 +351,7 @@ class ProofsRepository(models.Model): @receiver(post_save, sender=ProductionStream) def production_stream_create_proofs_repo(sender, instance, created, **kwargs): """ - If a ProductionStream instance is created, a Proofs Repository instance is created + When a ProductionStream instance is created, a ProofsRepository instance is created and linked to it. """ if created: @@ -362,3 +362,20 @@ def production_stream_create_proofs_repo(sender, instance, created, **kwargs): post_save.connect(production_stream_create_proofs_repo, sender=ProductionStream) + + +@receiver(post_save, sender=ProofsRepository) +def advance_repo_on_gitlab(sender, instance, created, **kwargs): + """ + When a ProofsRepository instance is created, run the advance_git_repos command on it. + """ + if created: + from django.core import management + + management.call_command( + "advance_git_repos", + id=instance.stream.submission.preprint.identifier_w_vn_nr, + ) + + +post_save.connect(advance_repo_on_gitlab, sender=ProofsRepository) -- GitLab