Closed Kurt57 closed 3 years ago
It seems to be a problem in schema_context, have you asked their repo ?
No the result of queryset is correct
def get_queryset(self):
with schema_context('public'):
qs = Product.objects.all().order_by('id')
print(qs)
print(self.request.build_absolute_uri())
return qs
The Print of above code for tenant.dev.de
<QuerySet [
Same Print of above code for dev.de
<QuerySet [
I don´t understand why the tenant url responses empty results even though i run same code with same return
Seems like I have found the solution with: overriding:
class ProductAutocomplete(CustomSelect2QuerySetView):
def dispatch(self, request, *args, **kwargs):
with schema_context('public'):
return super(ProductAutocomplete, self).dispatch(request, *args, **kwargs)
Thank you for posting the solution
Le lun. 15 mars 2021 à 23:27, Fatih Karakurt @.***> a écrit :
Closed #1225 https://github.com/yourlabs/django-autocomplete-light/issues/1225.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/yourlabs/django-autocomplete-light/issues/1225#event-4461359003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXDLA7WHVR2RMHT27O2UDTD2CVBANCNFSM4Y4T7SFQ .
Hi all,
i want provide my tenants autocompletion on products.
for example in my public schema (database) I have table for Products like Product A Product B Product C
so my tenants have the same table same model but every tenant has it's own schems. i want that my tenant if he want to create a Product only have to type
"Pro" and then gets the suggestion for Product A, B, C (suggestions come from public schema)
After choosing one this Product should also created on the tenants Product table with all fields.
No im struggling. Open Points:
safari shows an empty dropdown. Chrome works proper
The AutoCompletion don't works if I return the QuerySet of the public schema I realized so:
this returns in qs the correct products, so the routine is correct.
but if I call the url in browser
http://dev.de:8000/product-autocomplete/. -> against public schema http://tenantname.dev.de:8000/product-autocomplete/ -> against tenantname schema
the tenants urls result is: {"results": [], "pagination": {"more": false}}
both get their QuerySet form the routine above which is hardocded against public. but the tenants one results is empty. Why ever.
I think that's the problem, but idk how I can return the products from public schema here