Skip to content

Commit b48e336

Browse files
feat : add user to representation
1 parent d88e68e commit b48e336

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

backend/core/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,12 @@ def create(self, validated_data):
10871087
logging.info(f"Prediction request queued with task ID {task.id}")
10881088
return instance
10891089

1090+
def to_representation(self, instance):
1091+
ret = super().to_representation(instance)
1092+
if self.context.get("request") and self.context["request"].method == "GET":
1093+
ret["user"] = UserSerializer(instance.user).data
1094+
return ret
1095+
10901096

10911097
@method_decorator(
10921098
ratelimit(key="user", rate="50/h", method="POST", block=True), name="create"

0 commit comments

Comments
 (0)