From 8b9da605f51997fca0bb8aa53100009aea757869 Mon Sep 17 00:00:00 2001 From: Gytha Ogg Date: Mon, 15 Jul 2024 12:08:25 +0200 Subject: [PATCH 1/3] precommit: isort imports --- apis_ontology/tables.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/apis_ontology/tables.py b/apis_ontology/tables.py index 2de91c0..3dce97b 100644 --- a/apis_ontology/tables.py +++ b/apis_ontology/tables.py @@ -1,12 +1,15 @@ -from django.utils.html import escape +import logging import django_tables2 as tables from apis_core.apis_entities.tables import AbstractEntityTable +from apis_core.apis_metainfo.models import RootObject from apis_core.generic.tables import GenericTable -from django_tables2.utils import A from django.template.loader import render_to_string +from django.utils.html import format_html +from django.utils.safestring import mark_safe +from lxml import etree -from .models import Excerpts, Instance, Person, Place, TibScholRelationMixin, Work +from .models import Instance, Person, Place, TibScholRelationMixin, Work from .templatetags.filter_utils import ( preview_text, render_coordinate, @@ -15,15 +18,6 @@ ) from .templatetags.parse_comment import parse_comment -import django_tables2 as tables -import logging -from apis_core.apis_metainfo.models import RootObject - -from django.utils.safestring import mark_safe -from django.urls import reverse - -from lxml import etree - logger = logging.getLogger(__name__) From 7380aa2d89238c1f42e9111734871b8ed703a295 Mon Sep 17 00:00:00 2001 From: Gytha Ogg Date: Mon, 15 Jul 2024 12:09:12 +0200 Subject: [PATCH 2/3] style works in obj field based on extant status --- apis_ontology/tables.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apis_ontology/tables.py b/apis_ontology/tables.py index 3dce97b..3abce99 100644 --- a/apis_ontology/tables.py +++ b/apis_ontology/tables.py @@ -181,10 +181,13 @@ def linkify_excerpt_id(xml_id): return mark_safe("
".join(linked_lines)) def render_obj(self, record): + highlight_style = "" actual_obj = RootObject.objects_inheritance.get_subclass(pk=record.obj.pk) + if hasattr(actual_obj, "isExtant") and not actual_obj.isExtant: + highlight_style = "background-color: lightgray;" return mark_safe( - "" + str(actual_obj) From 28363ae5d3850b0f134d867e88f5a84504fa705e Mon Sep 17 00:00:00 2001 From: Gytha Ogg Date: Mon, 15 Jul 2024 12:09:38 +0200 Subject: [PATCH 3/3] style works in subj column based on extant status closes #87 --- apis_ontology/tables.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apis_ontology/tables.py b/apis_ontology/tables.py index 3abce99..e47c69d 100644 --- a/apis_ontology/tables.py +++ b/apis_ontology/tables.py @@ -196,9 +196,12 @@ def render_obj(self, record): def render_subj(self, record): actual_obj = RootObject.objects_inheritance.get_subclass(pk=record.subj.pk) + highlight_style = "" + if hasattr(actual_obj, "isExtant") and not actual_obj.isExtant: + highlight_style = "background-color: lightgray;" return mark_safe( - "" + str(actual_obj)