👔(backend) add code_editor column on Template

To save the template code editor content,
we need to add a new column on the Template model.
It is a JSONField that will store the code editor content.

We could in the future make an implementation to
save the code editor content in Minio.
This commit is contained in:
Anthony LC
2024-04-16 16:55:28 +02:00
committed by Anthony LC
parent 7922c702cd
commit 3aaa3e179d
5 changed files with 19 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ def test_api_templates_retrieve_anonymous_public():
},
"accesses": [],
"title": template.title,
"code_editor": {},
}
@@ -67,6 +68,7 @@ def test_api_templates_retrieve_authenticated_unrelated_public():
},
"accesses": [],
"title": template.title,
"code_editor": {},
}
@@ -131,6 +133,7 @@ def test_api_templates_retrieve_authenticated_related_direct():
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
}
@@ -244,6 +247,7 @@ def test_api_templates_retrieve_authenticated_related_team_members(
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
}
@@ -339,6 +343,7 @@ def test_api_templates_retrieve_authenticated_related_team_administrators(
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
}
@@ -438,4 +443,5 @@ def test_api_templates_retrieve_authenticated_related_team_owners(
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
}

View File

@@ -159,3 +159,8 @@ def test_models_templates_get_abilities_preset_role(django_assert_num_queries):
"manage_accesses": False,
"generate_document": True,
}
def test_models_templates_get_code_editor():
"""Check code_editor in the template model"""
template = factories.TemplateFactory(code_editor={"test": "ok"})
assert template.code_editor == {"test": "ok"}