mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-27 01:36:11 -06:00
Enable filtering jobs by object
This commit is contained in:
parent
d752d664f3
commit
6861db2885
@ -113,7 +113,7 @@ class JobFilterSet(BaseFilterSet):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Job
|
model = Job
|
||||||
fields = ('id', 'interval', 'status', 'user', 'object_type', 'name')
|
fields = ('id', 'object_type', 'object_id', 'name', 'interval', 'status', 'user')
|
||||||
|
|
||||||
def search(self, queryset, name, value):
|
def search(self, queryset, name, value):
|
||||||
if not value.strip():
|
if not value.strip():
|
||||||
|
@ -5,7 +5,6 @@ from fnmatch import fnmatchcase
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes.models import ContentType
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@ -15,6 +14,7 @@ from django.utils.module_loading import import_string
|
|||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from netbox.models import PrimaryModel
|
from netbox.models import PrimaryModel
|
||||||
|
from netbox.models.features import JobsMixin
|
||||||
from netbox.registry import registry
|
from netbox.registry import registry
|
||||||
from utilities.files import sha256_hash
|
from utilities.files import sha256_hash
|
||||||
from utilities.querysets import RestrictedQuerySet
|
from utilities.querysets import RestrictedQuerySet
|
||||||
@ -31,7 +31,7 @@ __all__ = (
|
|||||||
logger = logging.getLogger('netbox.core.data')
|
logger = logging.getLogger('netbox.core.data')
|
||||||
|
|
||||||
|
|
||||||
class DataSource(PrimaryModel):
|
class DataSource(JobsMixin, PrimaryModel):
|
||||||
"""
|
"""
|
||||||
A remote source, such as a git repository, from which DataFiles are synchronized.
|
A remote source, such as a git repository, from which DataFiles are synchronized.
|
||||||
"""
|
"""
|
||||||
|
@ -18,7 +18,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Report(JobsMixin, WebhooksMixin, models.Model):
|
class Report(WebhooksMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
Dummy model used to generate permissions for reports. Does not exist in the database.
|
Dummy model used to generate permissions for reports. Does not exist in the database.
|
||||||
"""
|
"""
|
||||||
@ -32,7 +32,7 @@ class ReportModuleManager(models.Manager.from_queryset(RestrictedQuerySet)):
|
|||||||
return super().get_queryset().filter(file_root=ManagedFileRootPathChoices.REPORTS)
|
return super().get_queryset().filter(file_root=ManagedFileRootPathChoices.REPORTS)
|
||||||
|
|
||||||
|
|
||||||
class ReportModule(PythonModuleMixin, ManagedFile):
|
class ReportModule(PythonModuleMixin, JobsMixin, ManagedFile):
|
||||||
"""
|
"""
|
||||||
Proxy model for report module files.
|
Proxy model for report module files.
|
||||||
"""
|
"""
|
||||||
|
@ -17,7 +17,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Script(JobsMixin, WebhooksMixin, models.Model):
|
class Script(WebhooksMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
Dummy model used to generate permissions for custom scripts. Does not exist in the database.
|
Dummy model used to generate permissions for custom scripts. Does not exist in the database.
|
||||||
"""
|
"""
|
||||||
@ -31,7 +31,7 @@ class ScriptModuleManager(models.Manager.from_queryset(RestrictedQuerySet)):
|
|||||||
return super().get_queryset().filter(file_root=ManagedFileRootPathChoices.SCRIPTS)
|
return super().get_queryset().filter(file_root=ManagedFileRootPathChoices.SCRIPTS)
|
||||||
|
|
||||||
|
|
||||||
class ScriptModule(PythonModuleMixin, ManagedFile):
|
class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
|
||||||
"""
|
"""
|
||||||
Proxy model for script module files.
|
Proxy model for script module files.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user