mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Fixes syntax error on reports (#12997)
* fixes syntax error on reports #12842 * remove the extra filter #12842
This commit is contained in:
parent
f69d99ea67
commit
3307bd200c
@ -1,7 +1,7 @@
|
|||||||
import inspect
|
import inspect
|
||||||
|
import logging
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from django.contrib.contenttypes.fields import GenericRelation
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
@ -12,6 +12,8 @@ from netbox.models.features import JobsMixin, WebhooksMixin
|
|||||||
from utilities.querysets import RestrictedQuerySet
|
from utilities.querysets import RestrictedQuerySet
|
||||||
from .mixins import PythonModuleMixin
|
from .mixins import PythonModuleMixin
|
||||||
|
|
||||||
|
logger = logging.getLogger('netbox.reports')
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'Report',
|
'Report',
|
||||||
'ReportModule',
|
'ReportModule',
|
||||||
@ -56,7 +58,8 @@ class ReportModule(PythonModuleMixin, JobsMixin, ManagedFile):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
module = self.get_module()
|
module = self.get_module()
|
||||||
except ImportError:
|
except (ImportError, SyntaxError) as e:
|
||||||
|
logger.error(f"Unable to load report module {self.name}, exception: {e}")
|
||||||
return {}
|
return {}
|
||||||
reports = {}
|
reports = {}
|
||||||
ordered = getattr(module, 'report_order', [])
|
ordered = getattr(module, 'report_order', [])
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
</h5>
|
</h5>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% include 'inc/sync_warning.html' with object=module %}
|
{% include 'inc/sync_warning.html' with object=module %}
|
||||||
|
{% if module.reports %}
|
||||||
<table class="table table-hover table-headings reports">
|
<table class="table table-hover table-headings reports">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -103,6 +104,11 @@
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
<i class="mdi mdi-alert"></i> Could not load reports from {{ module.name }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
|
Loading…
Reference in New Issue
Block a user