🔥(backend) remove code_editor field

code_editor field was removed from the backend.
This filed was used to store the code editor to
generate templates.
This commit is contained in:
Anthony LC
2024-05-02 14:13:15 +02:00
committed by Anthony LC
parent c7a5b5f3fb
commit 5fbb5106a9
6 changed files with 1 additions and 24 deletions

View File

@@ -148,7 +148,6 @@ class TemplateSerializer(BaseResourceSerializer):
fields = [
"id",
"title",
"code_editor",
"accesses",
"abilities",
"css",

View File

@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-31 18:49
# Generated by Django 5.0.3 on 2024-05-02 12:12
import django.contrib.auth.models
import django.core.validators
@@ -42,7 +42,6 @@ class Migration(migrations.Migration):
('updated_at', models.DateTimeField(auto_now=True, help_text='date and time at which a record was last updated', verbose_name='updated on')),
('title', models.CharField(max_length=255, verbose_name='title')),
('description', models.TextField(blank=True, verbose_name='description')),
('code_editor', models.JSONField(blank=True, default=dict, help_text='A JSON object with all the editor information', verbose_name='code editor')),
('code', models.TextField(blank=True, verbose_name='code')),
('css', models.TextField(blank=True, verbose_name='css')),
('is_public', models.BooleanField(default=False, help_text='Whether this template is public for anyone to use.', verbose_name='public')),

View File

@@ -327,12 +327,6 @@ class Template(BaseModel):
title = models.CharField(_("title"), max_length=255)
description = models.TextField(_("description"), blank=True)
code_editor = models.JSONField(
_("code editor"),
help_text=_("A JSON object with all the editor information"),
blank=True,
default=dict,
)
code = models.TextField(_("code"), blank=True)
css = models.TextField(_("css"), blank=True)
is_public = models.BooleanField(

View File

@@ -28,7 +28,6 @@ def test_api_templates_retrieve_anonymous_public():
},
"accesses": [],
"title": template.title,
"code_editor": {},
"is_public": True,
"code": template.code,
"css": template.css,
@@ -73,7 +72,6 @@ def test_api_templates_retrieve_authenticated_unrelated_public():
},
"accesses": [],
"title": template.title,
"code_editor": {},
"is_public": True,
"code": template.code,
"css": template.css,
@@ -141,7 +139,6 @@ def test_api_templates_retrieve_authenticated_related_direct():
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
"is_public": template.is_public,
"code": template.code,
"css": template.css,
@@ -258,7 +255,6 @@ def test_api_templates_retrieve_authenticated_related_team_members(
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
"is_public": False,
"code": template.code,
"css": template.css,
@@ -357,7 +353,6 @@ def test_api_templates_retrieve_authenticated_related_team_administrators(
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
"is_public": False,
"code": template.code,
"css": template.css,
@@ -460,7 +455,6 @@ def test_api_templates_retrieve_authenticated_related_team_owners(
"id": str(template.id),
"title": template.title,
"abilities": template.get_abilities(user),
"code_editor": {},
"is_public": False,
"code": template.code,
"css": template.css,

View File

@@ -167,9 +167,3 @@ def test_models_templates_get_abilities_preset_role(django_assert_num_queries):
"partial_update": 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"}

View File

@@ -1,5 +1,3 @@
import { ProjectData } from 'grapesjs';
export enum Role {
MEMBER = 'member',
ADMIN = 'administrator',
@@ -30,7 +28,6 @@ export interface Template {
partial_update: boolean;
};
accesses: Access[];
code_editor: ProjectData;
title: string;
is_public: boolean;
css: string;