Skip to content

Commit

Permalink
Merge pull request #280 from aiarena/fix-tag-search
Browse files Browse the repository at this point in the history
Change GroupConcat to output textfield to avoid length limits
  • Loading branch information
Immodal authored Jul 1, 2021
2 parents 9b7b35b + 8553362 commit f1443e0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions aiarena/core/d_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from django.db.models.fields import CharField
from django.db.models import Q, Aggregate, CharField
from django.db.models.fields import CharField, TextField
from django.db.models import Q, Aggregate
from rest_framework.exceptions import ValidationError

# File for housing utils that require 'django' or would break CI if placed in utils.py
Expand All @@ -11,13 +11,12 @@ class GroupConcat(Aggregate):
function = 'GROUP_CONCAT'
template = '%(function)s(%(distinct)s%(expressions)s%(ordering)s%(separator)s)'

def __init__(self, expression, distinct=False, ordering=None, separator=',', **extra):
def __init__(self, expression, ordering=None, separator=',', **extra):
super(GroupConcat, self).__init__(
expression,
distinct='DISTINCT ' if distinct else '',
ordering=' ORDER BY %s' % ordering if ordering is not None else '',
separator=' SEPARATOR "%s"' % separator,
output_field=CharField(),
output_field=TextField(),
**extra
)

Expand Down

0 comments on commit f1443e0

Please sign in to comment.