projects: модуль проектов с шагами по отделам и Task.
Шаблоны/ручное создание, access_projects, сид «Открытие аптеки». Плюс SILO/S3 для Django media. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
|
||||
from apps.tasks.models import Task
|
||||
|
||||
|
||||
@receiver(post_save, sender=Task)
|
||||
def recalculate_project_on_task_change(sender, instance: Task, **kwargs):
|
||||
from apps.projects.models import ProjectStepItem
|
||||
from apps.projects.services import refresh_project_status
|
||||
|
||||
item = (
|
||||
ProjectStepItem.objects
|
||||
.filter(task_id=instance.pk)
|
||||
.select_related('step__project')
|
||||
.first()
|
||||
)
|
||||
if item is None:
|
||||
return
|
||||
item.step.refresh_status(save=True)
|
||||
refresh_project_status(item.step.project)
|
||||
Reference in New Issue
Block a user