Skip to content

Conversation

nshafer
Copy link
Contributor

@nshafer nshafer commented Oct 14, 2014

If you have an aggregated field in your queryset, such as with:

Publisher.objects.annotate(num_books=Count('book'))

Trying to include this column 'num_books' in your CSV output results in a ValueError Exception with the error dict contains fields not in fieldnames: num_books. This fixes that by looking for column names for aggregates in the queryset.query, just like for extra columns.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.94%) when pulling 4eee1c1 on Tekco:master into 3ac10ab on azavea:master.

@steventlamb
Copy link
Contributor

Thanks for your contribution, this looks like a nice thing to add.

I've made another pull request on top of this that adds a unit test.

@steventlamb steventlamb merged commit 4eee1c1 into azavea:master Oct 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants