Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions console/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ def get_secret(setting, secrets=SECRETS):
"rest_framework.authentication.TokenAuthentication",
"rest_framework.authentication.SessionAuthentication",
),
# Pagination
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"PAGE_SIZE": 100,
}

# SAML
Expand Down
24 changes: 22 additions & 2 deletions console/django_scantron/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# Third party Python libraries.
from django.http import Http404, JsonResponse
from django.utils.timezone import localtime
from django_filters.rest_framework import DjangoFilterBackend
import redis
from rest_framework import mixins, viewsets
from rest_framework import filters, mixins, viewsets
from rest_framework.decorators import api_view
from rest_framework.permissions import IsAdminUser, IsAuthenticated
import rq
Expand Down Expand Up @@ -129,12 +130,31 @@ class ScanViewSet(DefaultsMixin, viewsets.ModelViewSet):
permission_classes = (IsAuthenticated, IsAdminUser)


class ScheduledScanViewSet(ListRetrieveUpdateViewSet, DefaultsMixin):
class ScheduledScanViewSet(ListRetrieveUpdateViewSet):
"""API CRUD operations for ScheduledScan Model."""

model = ScheduledScan
serializer_class = ScheduledScanSerializer

# Filter and search.
filter_backends = (DjangoFilterBackend, filters.SearchFilter)
filter_fields = (
"id",
"site_name",
"start_time",
"scan_engine",
"start_datetime",
"scan_binary",
"scan_command",
"targets",
"excluded_targets",
"scan_status",
"completed_time",
"result_file_base_name",
"pooled_scan_result_file_base_name",
"scan_binary_process_id",
)

def partial_update(self, request, pk=None, **kwargs):

# Any updates to this dictionary should also be updated in console/django_scantron/models.py
Expand Down