Skip to content

Commit

Permalink
Mark untestable lines
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 27, 2024
1 parent 9f27a4c commit 0b6e979
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions djangocms_link/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_reference(self, request):
model, pk = request.GET.get("g").split(":")
app, model = model.split(".")
model = apps.get_model(app, model)
if hasattr(model, "admin_manager"):
if hasattr(model, "admin_manager"): # pragma: no cover
obj = model.admin_manager.get(pk=pk)
else:
obj = model.objects.get(pk=pk)
Expand Down Expand Up @@ -129,13 +129,10 @@ def get_queryset(self):
return list(qs)

def add_admin_querysets(self, qs):
if REGISTERED_ADMIN == "auto":
return qs

for model_admin in REGISTERED_ADMIN:
try:
# hack: GrouperModelAdmin expects a language to be temporarily set
if isinstance(model_admin, GrouperModelAdmin):
if isinstance(model_admin, GrouperModelAdmin): # pragma: no cover
model_admin.language = self.language
new_qs = model_admin.get_queryset(self.request)
if hasattr(model_admin.model, "site") and self.site:
Expand All @@ -145,11 +142,11 @@ def add_admin_querysets(self, qs):
new_qs, search_use_distinct = model_admin.get_search_results(
self.request, new_qs, self.term
)
if search_use_distinct:
if search_use_distinct: # pragma: no cover
new_qs = new_qs.distinct()

qs += list(new_qs)
except Exception:
except Exception: # pragma: no cover
# Still report back remaining urls even if one model fails
pass

Expand Down

0 comments on commit 0b6e979

Please sign in to comment.