mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-13 03:49:36 -06:00
* Enable E501 rule * Configure ruff formatter * Reformat migration files to fix line length violations * Fix various E501 errors * Move table template code to template_code.py & ignore E501 errors * Reformat raw SQL
29 lines
858 B
Python
29 lines
858 B
Python
from core.choices import *
|
|
from core.models import Job
|
|
from netbox.api.fields import ChoiceField, ContentTypeField
|
|
from netbox.api.serializers import BaseModelSerializer
|
|
from users.api.serializers_.users import UserSerializer
|
|
|
|
__all__ = (
|
|
'JobSerializer',
|
|
)
|
|
|
|
|
|
class JobSerializer(BaseModelSerializer):
|
|
user = UserSerializer(
|
|
nested=True,
|
|
read_only=True
|
|
)
|
|
status = ChoiceField(choices=JobStatusChoices, read_only=True)
|
|
object_type = ContentTypeField(
|
|
read_only=True
|
|
)
|
|
|
|
class Meta:
|
|
model = Job
|
|
fields = [
|
|
'id', 'url', 'display_url', 'display', 'object_type', 'object_id', 'name', 'status', 'created', 'scheduled',
|
|
'interval', 'started', 'completed', 'user', 'data', 'error', 'job_id',
|
|
]
|
|
brief_fields = ('url', 'created', 'completed', 'user', 'status')
|