From 6dc2c6c9329ee832be1bc5caf77e2ae2245b0706 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Thu, 21 Nov 2024 18:23:02 +1030 Subject: [PATCH] issue #1199 - try to stop mandatory columns from being moved --- snpdb/models/models_columns.py | 9 +++++++++ .../page_help/settings/view_custom_columns_help.html | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/snpdb/models/models_columns.py b/snpdb/models/models_columns.py index 17cc76699..b27dcd0b3 100644 --- a/snpdb/models/models_columns.py +++ b/snpdb/models/models_columns.py @@ -28,8 +28,17 @@ class VariantGridColumn(models.Model): model_field = models.BooleanField(default=True) # Standard field, can use Meta inspection to determine colmodel queryset_field = models.BooleanField(default=True) # In queryset.values() (field or alias) + # These are required to be in custom columns + _MANDATORY_COLUMNS = { + "tags", + "tags_global", + } + def get_css_classes(self): css_classes = ["user-column"] + if self.grid_column_name in self._MANDATORY_COLUMNS: + css_classes.append("mandatory") + if self.annotation_level: annotation_level_class = ColumnAnnotationLevel(self.annotation_level).label css_classes.append("%s-column" % annotation_level_class.lower()) diff --git a/variantgrid/static_files/default_static/page_help/settings/view_custom_columns_help.html b/variantgrid/static_files/default_static/page_help/settings/view_custom_columns_help.html index 0c03409e4..f42150d06 100644 --- a/variantgrid/static_files/default_static/page_help/settings/view_custom_columns_help.html +++ b/variantgrid/static_files/default_static/page_help/settings/view_custom_columns_help.html @@ -1,6 +1,15 @@ Drag and drop columns to add/remove and change ordering. -The special first "variant" column is automatically created for all custom columns. + + +

Adding / Removing columns