{"action":"closed","number":347,"pull_request":{"created_at":"2011-11-01T20:06:12Z","state":"closed","review_comments":0,"updated_at":"2011-12-01T17:58:19Z","patch_url":"https://github.com/hmarr/mongoengine/pull/347.patch","changed_files":3,"_links":{"review_comments":{"href":"https://api.github.com/repos/hmarr/mongoengine/pulls/347/comments"},"comments":{"href":"https://api.github.com/repos/hmarr/mongoengine/issues/347/comments"},"html":{"href":"https://github.com/hmarr/mongoengine/pull/347"},"self":{"href":"https://api.github.com/repos/hmarr/mongoengine/pulls/347"}},"issue_url":"https://github.com/hmarr/mongoengine/issues/347","comments":5,"user":{"gravatar_id":"dab3070687bb065a7d43df70c9651375","id":165929,"url":"https://api.github.com/users/benwah","avatar_url":"https://secure.gravatar.com/avatar/dab3070687bb065a7d43df70c9651375?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"benwah"},"body":"I noticed that you cannot easily change the datatype and/or actual data returned by queryset.sum(), this is sometimes useful when writing a BaseField subclass for things like Currency.\r\n\r\nI added a \"aggregate_to_python\" method to BaseField. Any data returned by QuerySet.sum or QuerySet.average is passed to the field's aggregate_to_python method before being returned.\r\n\r\nI also added a few lines to mongoengine/tests/queryset.py that ensures the proper behaviour for custom fields with a aggregate_to_python method.\r\n","deletions":7,"merged":false,"commits":3,"mergeable":false,"id":453678,"number":347,"additions":74,"base":{"repo":{"created_at":"2009-11-22T23:28:24Z","pushed_at":"2011-12-01T16:16:52Z","updated_at":"2011-12-01T16:16:52Z","clone_url":"https://github.com/hmarr/mongoengine.git","private":false,"name":"mongoengine","master_branch":null,"watchers":607,"svn_url":"https://svn.github.com/hmarr/mongoengine","language":"Python","forks":154,"owner":{"gravatar_id":"dc3a4c4f6d1ae1445586e2444c435cd2","id":110275,"url":"https://api.github.com/users/hmarr","avatar_url":"https://secure.gravatar.com/avatar/dc3a4c4f6d1ae1445586e2444c435cd2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"hmarr"},"id":381983,"homepage":"http://mongoengine.org","description":"A Python Object-Document-Mapper for working with MongoDB","git_url":"git://github.com/hmarr/mongoengine.git","html_url":"https://github.com/hmarr/mongoengine","open_issues":34,"size":1112,"url":"https://api.github.com/repos/hmarr/mongoengine","fork":false,"ssh_url":"git@github.com:hmarr/mongoengine.git"},"user":{"gravatar_id":"dc3a4c4f6d1ae1445586e2444c435cd2","id":110275,"url":"https://api.github.com/users/hmarr","avatar_url":"https://secure.gravatar.com/avatar/dc3a4c4f6d1ae1445586e2444c435cd2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"hmarr"},"sha":"26f0c0662458614414fbd2ba9b6ca1cb185536d6","ref":"dev","label":"hmarr:dev"},"merged_by":null,"head":{"repo":{"created_at":"2011-11-01T18:14:12Z","pushed_at":"2011-11-01T19:52:22Z","updated_at":"2011-11-01T19:52:22Z","clone_url":"https://github.com/lesite/mongoengine.git","private":false,"name":"mongoengine","master_branch":null,"watchers":1,"svn_url":"https://svn.github.com/lesite/mongoengine","language":"Python","forks":0,"owner":{"gravatar_id":"ed5cc5ebede8279d4ef6337c2a97b22e","id":400287,"url":"https://api.github.com/users/lesite","avatar_url":"https://secure.gravatar.com/avatar/ed5cc5ebede8279d4ef6337c2a97b22e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"lesite"},"id":2689637,"homepage":"http://mongoengine.org","description":"A Python Object-Document-Mapper for working with MongoDB","git_url":"git://github.com/lesite/mongoengine.git","html_url":"https://github.com/lesite/mongoengine","open_issues":0,"size":268,"url":"https://api.github.com/repos/lesite/mongoengine","fork":true,"ssh_url":"git@github.com:lesite/mongoengine.git"},"user":{"gravatar_id":"ed5cc5ebede8279d4ef6337c2a97b22e","id":400287,"url":"https://api.github.com/users/lesite","avatar_url":"https://secure.gravatar.com/avatar/ed5cc5ebede8279d4ef6337c2a97b22e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"lesite"},"sha":"44256b43a1aecffce80830f258e3d2ccc67cc389","ref":"master","label":"lesite:master"},"title":"Add a aggregate_to_python method to BaseField, which allows customization of the data returned by QuerySet.sum and QuerySet.average","html_url":"https://github.com/hmarr/mongoengine/pull/347","closed_at":"2011-12-01T17:58:19Z","diff_url":"https://github.com/hmarr/mongoengine/pull/347.diff","url":"https://api.github.com/repos/hmarr/mongoengine/pulls/347","merged_at":null}}