Verified Commit 4a6df063 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Upgraded django to 2.1 and django-filters to 2.0

parent a2f8f335
......@@ -20,7 +20,7 @@ class TrackFavoriteViewSet(
viewsets.GenericViewSet,
):
filter_class = filters.TrackFavoriteFilter
filterset_class = filters.TrackFavoriteFilter
serializer_class = serializers.UserTrackFavoriteSerializer
queryset = models.TrackFavorite.objects.all().select_related("user")
permission_classes = [
......
......@@ -43,7 +43,7 @@ class LibraryFollowViewSet(
)
serializer_class = api_serializers.LibraryFollowSerializer
permission_classes = [permissions.IsAuthenticated]
filter_class = filters.LibraryFollowFilter
filterset_class = filters.LibraryFollowFilter
ordering_fields = ("creation_date",)
def get_queryset(self):
......@@ -168,7 +168,7 @@ class InboxItemViewSet(
)
serializer_class = api_serializers.InboxItemSerializer
permission_classes = [permissions.IsAuthenticated]
filter_class = filters.InboxItemFilter
filterset_class = filters.InboxItemFilter
ordering_fields = ("activity__creation_date",)
def get_queryset(self):
......
......@@ -49,7 +49,7 @@ class ManageActorFilterSet(filters.FilterSet):
},
)
)
local = filters.BooleanFilter(name="_", method="filter_local")
local = filters.BooleanFilter(field_name="_", method="filter_local")
class Meta:
model = federation_models.Actor
......
......@@ -22,7 +22,7 @@ class ManageUploadViewSet(
.order_by("-id")
)
serializer_class = serializers.ManageUploadSerializer
filter_class = filters.ManageUploadFilterSet
filterset_class = filters.ManageUploadFilterSet
permission_classes = (HasUserPermission,)
required_permissions = ["library"]
ordering_fields = [
......@@ -54,7 +54,7 @@ class ManageUserViewSet(
):
queryset = users_models.User.objects.all().order_by("-id")
serializer_class = serializers.ManageUserSerializer
filter_class = filters.ManageUserFilterSet
filterset_class = filters.ManageUserFilterSet
permission_classes = (HasUserPermission,)
required_permissions = ["settings"]
ordering_fields = ["date_joined", "last_activity", "username"]
......@@ -79,7 +79,7 @@ class ManageInvitationViewSet(
.select_related("owner")
)
serializer_class = serializers.ManageInvitationSerializer
filter_class = filters.ManageInvitationFilterSet
filterset_class = filters.ManageInvitationFilterSet
permission_classes = (HasUserPermission,)
required_permissions = ["settings"]
ordering_fields = ["creation_date", "expiration_date"]
......@@ -113,7 +113,7 @@ class ManageDomainViewSet(
.order_by("name")
)
serializer_class = serializers.ManageDomainSerializer
filter_class = filters.ManageDomainFilterSet
filterset_class = filters.ManageDomainFilterSet
permission_classes = (HasUserPermission,)
required_permissions = ["moderation"]
ordering_fields = [
......@@ -152,7 +152,7 @@ class ManageActorViewSet(
.prefetch_related("instance_policy")
)
serializer_class = serializers.ManageActorSerializer
filter_class = filters.ManageActorFilterSet
filterset_class = filters.ManageActorFilterSet
permission_classes = (HasUserPermission,)
required_permissions = ["moderation"]
ordering_fields = [
......@@ -198,7 +198,7 @@ class ManageInstancePolicyViewSet(
.select_related()
)
serializer_class = serializers.ManageInstancePolicySerializer
filter_class = filters.ManageInstancePolicyFilterSet
filterset_class = filters.ManageInstancePolicyFilterSet
permission_classes = (HasUserPermission,)
required_permissions = ["moderation"]
ordering_fields = ["id", "creation_date"]
......
......@@ -9,7 +9,7 @@ from . import utils
class ArtistFilter(filters.FilterSet):
q = fields.SearchFilter(search_fields=["name"])
playable = filters.BooleanFilter(name="_", method="filter_playable")
playable = filters.BooleanFilter(field_name="_", method="filter_playable")
class Meta:
model = models.Artist
......@@ -25,7 +25,7 @@ class ArtistFilter(filters.FilterSet):
class TrackFilter(filters.FilterSet):
q = fields.SearchFilter(search_fields=["title", "album__title", "artist__name"])
playable = filters.BooleanFilter(name="_", method="filter_playable")
playable = filters.BooleanFilter(field_name="_", method="filter_playable")
class Meta:
model = models.Track
......@@ -48,7 +48,7 @@ class UploadFilter(filters.FilterSet):
track_artist = filters.UUIDFilter("track__artist__uuid")
album_artist = filters.UUIDFilter("track__album__artist__uuid")
library = filters.UUIDFilter("library__uuid")
playable = filters.BooleanFilter(name="_", method="filter_playable")
playable = filters.BooleanFilter(field_name="_", method="filter_playable")
q = fields.SmartSearchFilter(
config=search.SearchConfig(
search_fields={
......@@ -86,7 +86,7 @@ class UploadFilter(filters.FilterSet):
class AlbumFilter(filters.FilterSet):
playable = filters.BooleanFilter(name="_", method="filter_playable")
playable = filters.BooleanFilter(field_name="_", method="filter_playable")
q = fields.SearchFilter(search_fields=["title", "artist__name" "source"])
class Meta:
......
......@@ -62,7 +62,7 @@ class ArtistViewSet(viewsets.ReadOnlyModelViewSet):
queryset = models.Artist.objects.all()
serializer_class = serializers.ArtistWithAlbumsSerializer
permission_classes = [common_permissions.ConditionalAuthentication]
filter_class = filters.ArtistFilter
filterset_class = filters.ArtistFilter
ordering_fields = ("id", "name", "creation_date")
def get_queryset(self):
......@@ -89,7 +89,7 @@ class AlbumViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class = serializers.AlbumSerializer
permission_classes = [common_permissions.ConditionalAuthentication]
ordering_fields = ("creation_date", "release_date", "title")
filter_class = filters.AlbumFilter
filterset_class = filters.AlbumFilter
def get_queryset(self):
queryset = super().get_queryset()
......@@ -172,7 +172,7 @@ class TrackViewSet(TagViewSetMixin, viewsets.ReadOnlyModelViewSet):
queryset = models.Track.objects.all().for_nested_serialization()
serializer_class = serializers.TrackSerializer
permission_classes = [common_permissions.ConditionalAuthentication]
filter_class = filters.TrackFilter
filterset_class = filters.TrackFilter
ordering_fields = (
"creation_date",
"title",
......@@ -375,7 +375,7 @@ class UploadViewSet(
]
owner_field = "library.actor.user"
owner_checks = ["read", "write"]
filter_class = filters.UploadFilter
filterset_class = filters.UploadFilter
ordering_fields = (
"creation_date",
"import_date",
......
......@@ -7,8 +7,8 @@ from . import models
class PlaylistFilter(filters.FilterSet):
q = filters.CharFilter(name="_", method="filter_q")
playable = filters.BooleanFilter(name="_", method="filter_playable")
q = filters.CharFilter(field_name="_", method="filter_q")
playable = filters.BooleanFilter(field_name="_", method="filter_playable")
class Meta:
model = models.Playlist
......
......@@ -33,7 +33,7 @@ class PlaylistViewSet(
IsAuthenticatedOrReadOnly,
]
owner_checks = ["write"]
filter_class = filters.PlaylistFilter
filterset_class = filters.PlaylistFilter
ordering_fields = ("id", "name", "creation_date", "modification_date")
@detail_route(methods=["get"])
......
......@@ -23,7 +23,7 @@ class RadioViewSet(
permissions.IsAuthenticated,
common_permissions.OwnerPermission,
]
filter_class = filtersets.RadioFilter
filterset_class = filtersets.RadioFilter
owner_field = "user"
owner_checks = ["write"]
......
......@@ -4,7 +4,7 @@ from funkwhale_api.music import models as music_models
class AlbumList2FilterSet(filters.FilterSet):
type = filters.CharFilter(name="_", method="filter_type")
type = filters.CharFilter(field_name="_", method="filter_type")
class Meta:
model = music_models.Album
......
# Bleeding edge Django
django>=2.0,<2.1
django>=2.1,<2.2
# Configuration
django-environ>=0.4,<0.5
......@@ -36,7 +36,7 @@ oauth2client<4
pendulum>=2,<3
persisting-theory>=0.2,<0.3
django-versatileimagefield>=1.9,<1.10
django-filter>=1.1,<1.2
django-filter>=2.0,<2.1
django-rest-auth>=0.9,<0.10
beautifulsoup4>=4.6,<4.7
Markdown>=2.6,<2.7
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment