Closed Fethienv closed 4 years ago
This doesn't make sense though -- if each of the internal QuerySet
instances has a different model we shouldn't arbitrarily choose one to build the query out of.
This doesn't make sense though -- if each of the internal
QuerySet
instances has a different model we shouldn't arbitrarily choose one to build the query out of.
Yes, same models are required, In my case, I used it to get the same table from multidatabases (horizontal scaling) and to avoid that error if we use django-querysetsequence in admin site
if each of the internal
QuerySet
instances has a different model we shouldn't arbitrarily choose one to build the query out of.
We can also add feature return a dictionary if models not the same
In my case, I used it to get the same table from multidatabases (horizontal scaling)
I suspect there's better ways to do this in Django -- maybe using a database router (or using a database proxy or something).
Arbitrarily choosing the first one doesn't make sense. I'd be more inclined to accept it if there's a check if all the models are the same.
Thanks, I used django-querysetsequence in this repository https://github.com/Fethienv/django-sharding
I'm going to close this as I think it is the wrong approach. I think I would accept a PR that checks if all the QuerySets
have the same underlying model before setting these properties. Also, please include tests! If you're interested in updating this, feel free to shout and I'll re-open it.
I got an error in admin site about no query attribute in QuerySetSequence object I added it from sql.Query(self.model)
I got another error when I delete record about no verbose_name attribute in QuerySetSequence object I add it from queryset.model.__meta.verbose_name ( args[0].model._meta.verbose_name)