# Path: django_remote_submission/views.py
# class ServerViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Server` instances."""
# 
#     queryset = Server.objects.all()
#     serializer_class = ServerSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('title', 'hostname', 'port')
#     pagination_class = StandardPagination
# 
# class JobViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Job` instances."""
# 
#     queryset = Job.objects.all()
#     serializer_class = JobSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('title', 'program', 'status', 'owner', 'server')
#     pagination_class = StandardPagination
# 
# class LogViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Log` instances."""
# 
#     queryset = Log.objects.all()
#     serializer_class = LogSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('time', 'content', 'stream', 'job')
#     pagination_class = StandardPagination
# 
# class JobUserStatus(TemplateView):
#     """Show status of all of user's jobs with live updates."""
# 
#     template_name = "django_remote_submission/job-user-status.html"
# 
# class ResultViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Result` instances."""
# 
#     queryset = Result.objects.all()
#     serializer_class = ResultSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('remote_filename', 'job')  # 'local_file',
#     pagination_class = StandardPagination
# 
#     class Meta:
#         filter_overrides = {
#             models.FileField: {
#                 'filter_class': django_filters.CharFilter,
#                 'extra': lambda f: {
#                     'lookup_expr': 'icontains',
#                 },
#             },
#         }


from rest_framework.routers import DefaultRouter
from django.conf.urls import url
from .views import (
    ServerViewSet, JobViewSet, LogViewSet, JobUserStatus, ResultViewSet
)
"""Provide default route mappings for serializers."""
# -*- coding: utf-8 -*-



router = DefaultRouter()
router.register(r'servers', ServerViewSet)
router.register(r'jobs', JobViewSet)
router.register(r'logs', LogViewSet)

# Path: django_remote_submission/views.py
# class ServerViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Server` instances."""
# 
#     queryset = Server.objects.all()
#     serializer_class = ServerSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('title', 'hostname', 'port')
#     pagination_class = StandardPagination
# 
# class JobViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Job` instances."""
# 
#     queryset = Job.objects.all()
#     serializer_class = JobSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('title', 'program', 'status', 'owner', 'server')
#     pagination_class = StandardPagination
# 
# class LogViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Log` instances."""
# 
#     queryset = Log.objects.all()
#     serializer_class = LogSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('time', 'content', 'stream', 'job')
#     pagination_class = StandardPagination
# 
# class JobUserStatus(TemplateView):
#     """Show status of all of user's jobs with live updates."""
# 
#     template_name = "django_remote_submission/job-user-status.html"
# 
# class ResultViewSet(viewsets.ModelViewSet):
#     """Allow users to create, read, and update :class:`Result` instances."""
# 
#     queryset = Result.objects.all()
#     serializer_class = ResultSerializer
#     permission_classes = (IsAuthenticatedOrReadOnly,)
#     filter_backends = (DjangoFilterBackend,)
#     filter_fields = ('remote_filename', 'job')  # 'local_file',
#     pagination_class = StandardPagination
# 
#     class Meta:
#         filter_overrides = {
#             models.FileField: {
#                 'filter_class': django_filters.CharFilter,
#                 'extra': lambda f: {
#                     'lookup_expr': 'icontains',
#                 },
#             },
#         }


# Path: django_remote_submission/urls.py
from rest_framework.routers import DefaultRouter
from django.conf.urls import url
from .views import (
    ServerViewSet, JobViewSet, LogViewSet, JobUserStatus, ResultViewSet
)

"""Provide default route mappings for serializers."""
# -*- coding: utf-8 -*-



router = DefaultRouter()
router.register(r'servers', ServerViewSet)
router.register(r'jobs', JobViewSet)
router.register(r'logs', LogViewSet)

router.register(r'results', ResultViewSet)