Logs are decreasing ordered

This commit is contained in:
Yohann D'ANELLO 2020-03-11 12:41:44 +01:00
parent f082f8523a
commit 06c97d75a0
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,7 @@ class UserSerializer(serializers.ModelSerializer):
'user_permissions',
)
class ContentTypeSerializer(serializers.ModelSerializer):
"""
REST API Serializer for Users.

View File

@ -3,6 +3,7 @@
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets
from rest_framework.filters import OrderingFilter
from .serializers import ChangelogSerializer
from ..models import Changelog
@ -16,5 +17,7 @@ class ChangelogViewSet(viewsets.ReadOnlyModelViewSet):
"""
queryset = Changelog.objects.all()
serializer_class = ChangelogSerializer
filter_backends = [DjangoFilterBackend]
filterset_fields = ['model', 'action', "instance_pk", 'user', 'ip',]
filter_backends = [DjangoFilterBackend, OrderingFilter]
filterset_fields = ['model', 'action', "instance_pk", 'user', 'ip', ]
ordering_fields = ['timestamp', ]
ordering = ['-timestamp', ]