mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 23:12:21 +01:00
Marietje 4.1: Addition of Django REST framework, Swagger, Dark mode and updates to Django and Bootstrap
This commit is contained in:
24
marietje/songs/api/v1/serializers.py
Normal file
24
marietje/songs/api/v1/serializers.py
Normal file
@ -0,0 +1,24 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
from marietje.api.v1.serializers import UserRelatedFieldSerializer
|
||||
from songs.models import Song, ReportNote
|
||||
|
||||
|
||||
class SongSerializer(serializers.ModelSerializer):
|
||||
user = UserRelatedFieldSerializer()
|
||||
|
||||
class Meta:
|
||||
model = Song
|
||||
fields = ["id", "artist", "title", "duration", "hash", "user", "rg_gain", "rg_peak"]
|
||||
|
||||
|
||||
class ReportNoteSerializer(serializers.ModelSerializer):
|
||||
user = UserRelatedFieldSerializer(many=False, read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = ReportNote
|
||||
fields = [
|
||||
"song",
|
||||
"note",
|
||||
"user",
|
||||
]
|
||||
Reference in New Issue
Block a user