mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-19 12:59:36 +02:00
chore: Add TripViewSet and TripSerializer for managing trips
This commit is contained in:
parent
c0900876c6
commit
8f0a8b2cc8
5 changed files with 78 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
from .models import Adventure
|
||||
from .models import Adventure, Trip
|
||||
from rest_framework import serializers
|
||||
|
||||
class AdventureSerializer(serializers.ModelSerializer):
|
||||
|
@ -16,4 +16,12 @@ class AdventureSerializer(serializers.ModelSerializer):
|
|||
# remove any ' from the url
|
||||
public_url = public_url.replace("'", "")
|
||||
representation['image'] = f"{public_url}/media/{instance.image.name}"
|
||||
return representation
|
||||
return representation
|
||||
|
||||
class TripSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Trip
|
||||
fields = '__all__' # Serialize all fields of the Adventure model
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue