Closed rob101 closed 3 years ago
Just to add further clarity; this edge case occurs only when you don't use the TenantManagerMixin
on the tenant model.
This actually makes sense, as in the example above I might want a simple administrative ListView
for all my stores (tenants), which I otherwise would not be able to see if I was filtering the queryset.
Hi Rob, I noticed that I didn't tell you about the PR I created to fix that issue. Sorry about that. Here it is. https://github.com/citusdata/django-multitenant/pull/88 I'll merge and release a new version sometimes next week. If you have time to test it to double check that it fixes your issue, it would be great.
@louiseGrandjonc Yes, I have tested this and #88 resolves this issue. Thanks
Great, thank you! I've released a new version 2.2.4 with the fix
When updating a tenant model if another current tenant is set then an integrity error is thrown due to a duplicate key value.
For example, consider the following tenant model:
Create 2 objects and set the current tenant to the first:
Then attempt to update the second object
s2
whilst thecurrent_tenant
is still set tos1
.This results in: