[PATCH] issue #13844 "Errors when using character fields for aggregation" #67

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
@valhallasw

https://code.djangoproject.com/ticket/13844

This patch solves the issue by using Field.to_python() to do conversion, instead of having dispatching logic in the database operations layer.

50edfe6 adds a regression test which specifically addresses #13844;
b0bdaf4 removes the conversion logic from BaseDatabaseOperations, dispatching it to Field.to_python() instead.

valhallasw added some commits May 16, 2012

Added regression test for #13844
This test acts as close to the problem as possible - by running
convert_values directly. Note that this test does not trigger under
sqlite, as the sqlite layer overrides convert_value behavior.
Fix for #13844: convert using Field.to_python
Instead of adding another option in convert_value, I think it is
more sensible (and certainly more friendly to third party Fields)
to use functionality in Fields instead of in the database layer.

This version passes all current aggregation and aggregation_regress
tests under both sqlite and postgresql. Note that sqlite currently
overrides convert_value, which means it does *not* use to_python
as fields define them.
@akaariai

This comment has been minimized.

Show comment
Hide comment
@akaariai

akaariai Jul 16, 2012

Member

I am closing this pull request. I am proposing using akaariai/django@fe1e4f4 instead. The test is same, but no use of to_python, just remove the float(value) from the end of the method.

Member

akaariai commented Jul 16, 2012

I am closing this pull request. I am proposing using akaariai/django@fe1e4f4 instead. The test is same, but no use of to_python, just remove the float(value) from the end of the method.

@akaariai akaariai closed this Jul 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment