Commit 194d5ebe authored by okhin's avatar okhin 🚴

Get the site from the site framework, and let's roll

parent 92dee81b
Pipeline #1130 passed with stage
in 43 seconds
from picampaign.organization.models import FeedbackCategory, Group, GroupType, Organization from django.contrib.sites.shortcuts import get_current_site
from rest_framework import serializers from rest_framework import serializers
from picampaign.organization.models import FeedbackCategory, Group, GroupType, Organization
class CategorySerializer(serializers.ModelSerializer): class CategorySerializer(serializers.ModelSerializer):
...@@ -24,6 +26,12 @@ class GroupTypeSerializer(serializers.ModelSerializer): ...@@ -24,6 +26,12 @@ class GroupTypeSerializer(serializers.ModelSerializer):
class OrganizationSerializer(serializers.ModelSerializer): class OrganizationSerializer(serializers.ModelSerializer):
logo = serializers.SerializerMethodField()
class Meta: class Meta:
model = Organization model = Organization
fields = ('id', 'name', 'description', 'website', 'logo',) fields = ('id', 'name', 'description', 'website', 'logo',)
def get_logo(self, obj):
if obj.logo:
return get_current_site + obj.logo.url
return None
Markdown is supported
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