morlandi / django-ajax-datatable

A Django app which provides the integration of a Django project with the jQuery Javascript library DataTables.net
MIT License
204 stars 64 forks source link

What's the best practice to use non default database #91

Closed fockez closed 1 year ago

fockez commented 1 year ago

I have defined several databases in settings.py. Commonly, I use "using('xxx')" to query specific database. But how should I set this in django-ajax-datatable easily?

morlandi commented 1 year ago

I'm sorry, I'm not very familiar with this .. isn't it possible to associate the Model class itself to a specifica database ? Either for reading, writing or both ? Should this be possible, you would just associate the Model to a specifica AjxDatatableView as usual.

Or, I would try to solve overridding get_initial_queryset

Let me know if this help ;)

fockez commented 1 year ago

OK, i see. I will use database router to deal with this. At first, I thought there may be a class attribution to define a non default database.

morlandi commented 1 year ago

ok then