The first error is (in part) as you’ve identified. You’re trying to create an OrderItem object by passing a queryset for Project
as the item
parameter, where item
is a ForeignKey to Item
, not Project
.
The other part of the error here is that the .filter
call returns a queryset, and not an instance. However, that item
parameter in get_or_create
needs to be given an instance of Item
, not a queryset.
What do you think is the cause of the this error?