mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 23:29:17 +02:00
Import request viewset, serializer and url
This commit is contained in:
parent
f3d77ef7d9
commit
98b62caa24
6 changed files with 100 additions and 0 deletions
27
api/funkwhale_api/requests/serializers.py
Normal file
27
api/funkwhale_api/requests/serializers.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
class ImportRequestSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = models.ImportRequest
|
||||
fields = (
|
||||
'id',
|
||||
'status',
|
||||
'albums',
|
||||
'artist_name',
|
||||
'user',
|
||||
'creation_date',
|
||||
'imported_date',
|
||||
'comment')
|
||||
read_only_fields = (
|
||||
'creation_date',
|
||||
'imported_date',
|
||||
'user',
|
||||
'status')
|
||||
|
||||
def create(self, validated_data):
|
||||
validated_data['user'] = self.context['user']
|
||||
return super().create(validated_data)
|
Loading…
Add table
Add a link
Reference in a new issue