morlandi / django-ajax-datatable

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

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

Closed fockez closed 2 years ago

fockez commented 2 years 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 2 years 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 2 years 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 2 years ago

ok then