gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
26
core/apps/eggs/serializers/history.py
Normal file
26
core/apps/eggs/serializers/history.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from rest_framework import serializers
|
||||
from core.apps.eggs.models import History
|
||||
|
||||
|
||||
class HistorySerializer(serializers.ModelSerializer):
|
||||
avatar = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = History
|
||||
fields = [
|
||||
"id",
|
||||
"content_type",
|
||||
"object_id",
|
||||
"action",
|
||||
"avatar",
|
||||
"timestamp",
|
||||
"created_by",
|
||||
"created_who",
|
||||
"comment",
|
||||
"reason",
|
||||
]
|
||||
|
||||
def get_avatar(self, obj):
|
||||
if obj.avatar and hasattr(obj.avatar, "url"):
|
||||
return obj.avatar.url
|
||||
return None
|
||||
Reference in New Issue
Block a user