Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: return iterables from groupconcat #646

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions django_mysql/models/aggregates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db.models import Aggregate, CharField
from django_mysql.models.fields import SetCharField, ListCharField


class BitAnd(Aggregate):
Expand All @@ -23,8 +24,10 @@ def __init__(self, expression, distinct=False, separator=None,
ordering=None, **extra):

if 'output_field' not in extra:
# This can/will be improved to SetTextField or ListTextField
extra['output_field'] = CharField()
if distinct:
extra['output_field'] = SetCharField(CharField())
else:
extra['output_field'] = ListCharField(CharField())

super(GroupConcat, self).__init__(expression, **extra)

Expand Down