Проблема передачи параметров маршрутизации базы данных Django
class AuthRouter:
def db_for_read(self, model, **hints):
"""
Attempts to read auth and contenttypes models go to auth_db.
"""
params = hints.get('params')
return 'default'
def db_for_write(self, model, **hints):
"""
Attempts to write auth and contenttypes models go to auth_db.
"""
params = hints.get('params')
return 'default'
Я хочу передать некоторые параметры в **hints, но не знаю как это сделать, подскажите пожалуйста, большое спасибо!
Я пробовал следующие методы, но ни один из них не работает
# read
TestModel.objects({'params': 'Hello World'}).filter() # {TypeError}'UserManager' object is not callable
TestModel.objects.filter(hints={'params': 'Hello World'}) # {FieldError} Cannot resolve keyword 'hints' into field ...
# write
TestModel.objects.filter().first().save(hints={'params': 'Hello World'}) # {TypeError}save() got an unexpected keyword argument 'hints'