Fixed get template on post_save handler
parent
39e0e2dcf7
commit
eb48d72afe
|
@ -35,6 +35,7 @@ from django_pgjson.fields import JsonField
|
||||||
|
|
||||||
from taiga.users.models import Role
|
from taiga.users.models import Role
|
||||||
from taiga.domains.models import DomainMember
|
from taiga.domains.models import DomainMember
|
||||||
|
from taiga.domains import get_active_domain
|
||||||
from taiga.projects.userstories.models import UserStory
|
from taiga.projects.userstories.models import UserStory
|
||||||
from taiga.base.utils.slug import slugify_uniquely
|
from taiga.base.utils.slug import slugify_uniquely
|
||||||
from taiga.base.utils.dicts import dict_sum
|
from taiga.base.utils.dicts import dict_sum
|
||||||
|
@ -832,6 +833,9 @@ def project_post_save(sender, instance, created, **kwargs):
|
||||||
return
|
return
|
||||||
|
|
||||||
template_slug = getattr(instance, "template", settings.DEFAULT_PROJECT_TEMPLATE)
|
template_slug = getattr(instance, "template", settings.DEFAULT_PROJECT_TEMPLATE)
|
||||||
template = ProjectTemplate.objects.get(slug=template_slug, domain__isnull=True)
|
template = ProjectTemplate.objects.filter(slug=template_slug).get(
|
||||||
|
models.Q(domain__isnull=True) | models.Q(domain=get_active_domain())
|
||||||
|
)
|
||||||
|
|
||||||
template.apply_to_project(instance)
|
template.apply_to_project(instance)
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|
Loading…
Reference in New Issue