1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-03-13 04:03:22 +00:00

Merge branch '3022-field-description-is-lost-on-field-duplication-table-duplication-etc' into 'develop'

Resolve "Field description is lost on field duplication, table duplication, etc"

Closes 

See merge request 
This commit is contained in:
Bram Wiepjes 2024-10-15 10:04:31 +00:00
commit 6b4557cba0
6 changed files with 34 additions and 0 deletions
backend
changelog/entries/unreleased/bug

View file

@ -901,6 +901,7 @@ class FieldType(
"id": field.id,
"type": self.type,
"name": field.name,
"description": field.description,
"order": field.order,
"primary": field.primary,
"read_only": field.read_only,

View file

@ -242,6 +242,7 @@ def test_to_baserow_database_export():
"type": "text",
"id": "fldG9y88Zw7q7u4Z7i4",
"name": "Name",
"description": None,
"order": 0,
"primary": True,
"text_default": "",
@ -253,6 +254,7 @@ def test_to_baserow_database_export():
"type": "email",
"id": "fldB7wkyR0buF1sRF9O",
"name": "Email",
"description": None,
"order": 1,
"primary": False,
"read_only": False,
@ -360,6 +362,7 @@ def test_to_baserow_database_export_without_primary_value():
"type": "text",
"id": "primary_field",
"name": "Primary field (auto created)",
"description": None,
"order": 32767,
"primary": True,
"text_default": "",

View file

@ -292,6 +292,7 @@ def test_import_export_created_by_field(data_fixture):
assert field_serialized == {
"id": field.id,
"name": "modified by",
"description": None,
"order": field.order,
"primary": False,
"read_only": False,

View file

@ -44,12 +44,33 @@ def test_import_export_text_field(data_fixture):
)
assert text_field.id != text_field_imported.id
assert text_field.name == text_field_imported.name
assert text_field.description == text_field_imported.description
assert text_field.order == text_field_imported.order
assert text_field.primary == text_field_imported.primary
assert text_field.text_default == text_field_imported.text_default
assert id_mapping["database_fields"][text_field.id] == text_field_imported.id
@pytest.mark.django_db
def test_import_export_text_field_with_description(data_fixture):
id_mapping = {}
text_field = data_fixture.create_text_field(
name="Text name", text_default="", description="test"
)
text_field_type = field_type_registry.get_by_model(text_field)
text_serialized = text_field_type.export_serialized(text_field)
text_field_imported = text_field_type.import_serialized(
text_field.table,
text_serialized,
ImportExportConfig(include_permission_data=True),
id_mapping,
DeferredForeignKeyUpdater(),
)
assert text_field.id != text_field_imported.id
assert text_field.description == text_field_imported.description == "test"
@pytest.mark.django_db
def test_import_export_immutable_field(data_fixture):
id_mapping = {}

View file

@ -288,6 +288,7 @@ def test_import_export_last_modified_by_field(data_fixture):
assert field_serialized == {
"id": field.id,
"name": "modified by",
"description": None,
"order": field.order,
"primary": False,
"type": "last_modified_by",

View file

@ -0,0 +1,7 @@
{
"type": "bug",
"message": "Include the field description in export/import",
"issue_number": 3022,
"bullet_points": [],
"created_at": "2024-10-14"
}