-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor views for better mysql/es separation
Instead of checking a boolean flag in multiple different places, we use class inheritance. This makes it possible to later override the view and implement our own using a different search backend, such as Meilisearch.
- Loading branch information
Showing
8 changed files
with
226 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.conf import settings | ||
|
||
from .common import ( | ||
AnnotationDetailView, | ||
AnnotationListView, | ||
AnnotationRetireView, | ||
) | ||
|
||
from .exceptions import SearchViewRuntimeError | ||
|
||
def get_views_module(): | ||
""" | ||
Import views from either mysql or elasticsearch backend | ||
""" | ||
if settings.ES_DISABLED: | ||
from . import common as backend_module | ||
else: | ||
from . import elasticsearch as backend_module | ||
return backend_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.