[Answered ]-Django-Piston – I Can't POST on a model with a ForeignKey

2👍

You need to assign an actual object. Something like the following should work:

loc = Location.objects.get(pk=1)
obj.location = loc
obj.save()

where obj is the model you’re trying to save which has location as a foreign key.

👤ars

Leave a comment