kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Serialize user with requests
rodzic
64290465e7
commit
999198b1c5
|
@ -1,9 +1,12 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.users.serializers import UserBasicSerializer
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
class ImportRequestSerializer(serializers.ModelSerializer):
|
||||
user = UserBasicSerializer(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = models.ImportRequest
|
||||
|
|
|
@ -17,7 +17,7 @@ class ImportRequestViewSet(
|
|||
viewsets.GenericViewSet):
|
||||
|
||||
serializer_class = serializers.ImportRequestSerializer
|
||||
queryset = models.ImportRequest.objects.all()
|
||||
queryset = models.ImportRequest.objects.all().select_related()
|
||||
search_fields = ['artist_name', 'album_name', 'comment']
|
||||
|
||||
def perform_create(self, serializer):
|
||||
|
|
|
@ -3,6 +3,12 @@ from rest_framework import serializers
|
|||
from . import models
|
||||
|
||||
|
||||
class UserBasicSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = models.User
|
||||
fields = ['id', 'username', 'name', 'date_joined']
|
||||
|
||||
|
||||
class UserSerializer(serializers.ModelSerializer):
|
||||
|
||||
permissions = serializers.SerializerMethodField()
|
||||
|
|
Ładowanie…
Reference in New Issue