-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: WIP: refactor views to use new get_filtered_tags()
- Loading branch information
1 parent
c7c24e6
commit 8b81b1b
Showing
5 changed files
with
139 additions
and
46 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,23 @@ | ||
""" | ||
Utilities for tagging and taxonomy models | ||
""" | ||
|
||
from django.db.models.expressions import Func | ||
|
||
class ConcatNull(Func): | ||
""" | ||
Concatenate two arguments together. Like normal SQL but unlike Django's | ||
"Concat", if either argument is NULL, the result will be NULL. | ||
""" | ||
|
||
function = "CONCAT" | ||
|
||
def as_sqlite(self, compiler, connection, **extra_context): | ||
""" SQLite doesn't have CONCAT() but has a concatenation operator """ | ||
return super().as_sql( | ||
compiler, | ||
connection, | ||
template="%(expressions)s", | ||
arg_joiner=" || ", | ||
**extra_context, | ||
) |
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
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