2👍
✅
You can pass b
as argument of save
method (docs). This will add booking_ref
for new tickets:
serialized = TicketSerializer(data=request.data, many=True)
if serialized.is_valid():
b = BookTicket.objects.create(user=request.user)
serialized.save(booking_ref=b)
Source:stackexchange.com