1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-27 02:43:01 +00:00

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', 'user_permissions',
) )
class ContentTypeSerializer(serializers.ModelSerializer): class ContentTypeSerializer(serializers.ModelSerializer):
""" """
REST API Serializer for Users. REST API Serializer for Users.

View File

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