Skip to content

Commit

Permalink
object must be saved before using in related lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszn committed Aug 1, 2023
1 parent 80279a0 commit a46f403
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def new(self, request):
init[key] = obj.pk

obj = self.model(**init)
obj.save()
serializer = self.get_serializer(obj)
data = serializer.data
serializer.add_lookups(data)
Expand Down

0 comments on commit a46f403

Please sign in to comment.