Aakash Nihalani
Aakash Nihalani

Reputation: 75

Use Non default database with ManyRelatedManager methods in django

I want to use a non default database with ManyRelatedManager's set method in django.

I have tried the following methods:

  1. By mentioning the using method in the query

    It gives me the following error: AttributeError: 'QuerySet' object has no attribute 'set'

  2. By using the db_manager with the relatedmanager like this: modelA.modelB_set.db_manager('new_db').set(modelB_list)

    This doesn't give any error, but it uses the default database to do this.

Is there any way that I can use a non default database with set method of ManyRelatedManager? Thanks in advance.

Upvotes: 1

Views: 52

Answers (0)

Related Questions