Closed sfinktah closed 7 months ago
The following code is otherwise unworkable:
ebay_transaction = EbayOrderTransaction.update_or_create({'transaction_id': d['transaction_id']}, d) ebay_order.attach('transactions', ebay_transaction)
as the primary id key is not returned, and one cannot call fresh on the result. it is possible [but undesirable] to work around this in such a way as:
fresh
ebay_order = EbayOrder.where({'order_id': d['order_id']}).first() if not ebay_order: ebay_order = EbayOrder.create(d).fresh() else: ebay_order.save()
this PR also fixes an issue (that no doubt occurs in many other places too) were
return cls.builder.create( return cls.builder.create( dictionary, id_key=cls.__primary_key__, cast=cast, **kwargs dictionary, cast=cast, **kwargs )
will raise an Exception as the library is already passing id_key via kwargs
id_key
kwargs
@sfinktah fix the linter issues.
The following code is otherwise unworkable:
as the primary id key is not returned, and one cannot call
fresh
on the result. it is possible [but undesirable] to work around this in such a way as:this PR also fixes an issue (that no doubt occurs in many other places too) were
will raise an Exception as the library is already passing
id_key
viakwargs