getting related data from database other than default

7 views
Skip to first unread message

progm...@gmail.com

unread,
Feb 18, 2019, 5:01:25 PM2/18/19
to Django users
Hi,

I'm having some trouble getting data from a database with foreign-keys. 

Normally a query-set retrieved like this, obj = model.objects.all().filter(id=pk).select_related(), would give me the table row data, and the related row data from another table defined in the model, of the default database.
And normally if I say, obj = model.objects.all().filter(id=pk).using('somedatabase'), I get the data from the row in the using defined database.

But I cant seem to get the related data from a using database. For instance, obj = model.objects.all().filter(id=pk).select_related().using('somedatabase'), gives me all the data from the 'using' database but never any of the related data of the 'using' database.

Does anyone have any ideas?

Thanks
Reply all
Reply to author
Forward
0 new messages