Adding pagination disabled for history
parent
a9ecac7c1c
commit
3b48c1fa95
|
@ -20,7 +20,9 @@
|
||||||
from .viewsets import ModelListViewSet
|
from .viewsets import ModelListViewSet
|
||||||
from .viewsets import ModelCrudViewSet
|
from .viewsets import ModelCrudViewSet
|
||||||
from .viewsets import GenericViewSet
|
from .viewsets import GenericViewSet
|
||||||
|
from .viewsets import ReadOnlyListViewSet
|
||||||
|
|
||||||
__all__ = ["ModelCrudViewSet",
|
__all__ = ["ModelCrudViewSet",
|
||||||
"ModelListViewSet",
|
"ModelListViewSet",
|
||||||
"GenericViewSet"]
|
"GenericViewSet",
|
||||||
|
"ReadOnlyListViewSet"]
|
||||||
|
|
|
@ -124,6 +124,13 @@ class GenericViewSet(ViewSetMixin, generics.GenericAPIView):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class ReadOnlyListViewSet(pagination.HeadersPaginationMixin,
|
||||||
|
pagination.ConditionalPaginationMixin,
|
||||||
|
GenericViewSet):
|
||||||
|
"""
|
||||||
|
A viewset that provides default `list()` action.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
class ReadOnlyModelViewSet(mixins.RetrieveModelMixin,
|
class ReadOnlyModelViewSet(mixins.RetrieveModelMixin,
|
||||||
mixins.ListModelMixin,
|
mixins.ListModelMixin,
|
||||||
|
|
|
@ -18,17 +18,15 @@ from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.permissions import IsAuthenticated
|
|
||||||
|
|
||||||
from taiga.base.api import GenericViewSet
|
from taiga.base.api import ReadOnlyListViewSet
|
||||||
from taiga.base.filters import IsProjectMemberFilterBackend
|
|
||||||
|
|
||||||
from . import permissions
|
from . import permissions
|
||||||
from . import serializers
|
from . import serializers
|
||||||
from . import services
|
from . import services
|
||||||
|
|
||||||
|
|
||||||
class HistoryViewSet(GenericViewSet):
|
class HistoryViewSet(ReadOnlyListViewSet):
|
||||||
serializer_class = serializers.HistoryEntrySerializer
|
serializer_class = serializers.HistoryEntrySerializer
|
||||||
|
|
||||||
content_type = None
|
content_type = None
|
||||||
|
|
|
@ -23,6 +23,7 @@ from django.db.models import Q
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from easy_thumbnails.files import get_thumbnailer
|
from easy_thumbnails.files import get_thumbnailer
|
||||||
|
from easy_thumbnails.exceptions import InvalidImageFormatError
|
||||||
|
|
||||||
from taiga.base import exceptions as exc
|
from taiga.base import exceptions as exc
|
||||||
from taiga.base.utils.urls import get_absolute_url
|
from taiga.base.utils.urls import get_absolute_url
|
||||||
|
@ -54,8 +55,11 @@ def get_and_validate_user(*, username:str, password:str) -> bool:
|
||||||
|
|
||||||
def get_photo_url(photo):
|
def get_photo_url(photo):
|
||||||
"""Get a photo absolute url and the photo automatically cropped."""
|
"""Get a photo absolute url and the photo automatically cropped."""
|
||||||
url = get_thumbnailer(photo)['avatar'].url
|
try:
|
||||||
return get_absolute_url(url)
|
url = get_thumbnailer(photo)['avatar'].url
|
||||||
|
return get_absolute_url(url)
|
||||||
|
except InvalidImageFormatError as e:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_photo_or_gravatar_url(user):
|
def get_photo_or_gravatar_url(user):
|
||||||
|
@ -67,8 +71,11 @@ def get_photo_or_gravatar_url(user):
|
||||||
|
|
||||||
def get_big_photo_url(photo):
|
def get_big_photo_url(photo):
|
||||||
"""Get a big photo absolute url and the photo automatically cropped."""
|
"""Get a big photo absolute url and the photo automatically cropped."""
|
||||||
url = get_thumbnailer(photo)['big-avatar'].url
|
try:
|
||||||
return get_absolute_url(url)
|
url = get_thumbnailer(photo)['big-avatar'].url
|
||||||
|
return get_absolute_url(url)
|
||||||
|
except InvalidImageFormatError as e:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_big_photo_or_gravatar_url(user):
|
def get_big_photo_or_gravatar_url(user):
|
||||||
|
|
Loading…
Reference in New Issue