From 8c41c6785dfb63700d433a8ad22548c161f4722f Mon Sep 17 00:00:00 2001 From: kevgliss Date: Mon, 15 May 2017 19:07:32 -0700 Subject: [PATCH] Fixes issue where domains without any associated certificates are not searchable. (#797) --- lemur/domains/service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lemur/domains/service.py b/lemur/domains/service.py index 511fa2be..60da1062 100644 --- a/lemur/domains/service.py +++ b/lemur/domains/service.py @@ -76,7 +76,7 @@ def render(args): :param args: :return: """ - query = database.session_query(Domain).join(Certificate, Domain.certificate) + query = database.session_query(Domain) filt = args.pop('filter') certificate_id = args.pop('certificate_id', None) @@ -85,6 +85,7 @@ def render(args): query = database.filter(query, Domain, terms) if certificate_id: + query = query.join(Certificate, Domain.certificates) query = query.filter(Certificate.id == certificate_id) return database.sort_and_page(query, Domain, args)