From d83a00b0d3d5f4e4f947b1ebae34644389c0e903 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 28 Aug 2024 15:53:28 +0930 Subject: [PATCH] Actual helpful comments --- genes/models.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/genes/models.py b/genes/models.py index 18f5b1170..1d5fe22eb 100644 --- a/genes/models.py +++ b/genes/models.py @@ -170,10 +170,16 @@ def __str__(self): class GeneSymbol(models.Model, PreviewModelMixin): """ - If you need to perform a 'like' query on this field, you need to: + If you want to do a like on symbol and get an error: + GeneSymbol.objects.filter(symbol__startswith='GATA') + django.db.utils.NotSupportedError: nondeterministic collations are not supported for operator class "text_pattern_ops" + + Instead you need to do: + + GeneSymbol.get_deterministic_queryset().filter(symbol_deterministic__startswith='GATA') """ - symbol = TextField(primary_key=True, db_collation='case_insensitive') + symbol = TextField(primary_key=True, db_collation='case_insensitive') # See note above if 'like' breaks objects = ObjectManagerCachingRequest()