{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/22789468","id":22789468,"diff_hunk":"@@ -70,9 +72,11 @@ def db_type(self, connection):\n         size = self.size or ''\n         return '%s[%s]' % (self.base_field.db_type(connection), size)\n \n-    def get_prep_value(self, value):\n+    def get_db_prep_value(self, value, connection, prepared=False):\n+        if isinstance(self.base_field, GenericIPAddressField):","path":"django/contrib/postgres/fields/array.py","position":20,"original_position":20,"commit_id":"f87c7bf8141e77ed25d53e2ee56a4d34c49f111d","original_commit_id":"f87c7bf8141e77ed25d53e2ee56a4d34c49f111d","user":{"login":"timgraham","id":411869,"avatar_url":"https://avatars.githubusercontent.com/u/411869?v=3","gravatar_id":"","url":"https://api.github.com/users/timgraham","html_url":"https://github.com/timgraham","followers_url":"https://api.github.com/users/timgraham/followers","following_url":"https://api.github.com/users/timgraham/following{/other_user}","gists_url":"https://api.github.com/users/timgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/timgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timgraham/subscriptions","organizations_url":"https://api.github.com/users/timgraham/orgs","repos_url":"https://api.github.com/users/timgraham/repos","events_url":"https://api.github.com/users/timgraham/events{/privacy}","received_events_url":"https://api.github.com/users/timgraham/received_events","type":"User","site_admin":false},"body":"Seems like a generic hook could be useful here so we aren't handling field particularities in the field (i.e. how will custom fields handle this problem?)","created_at":"2015-01-12T13:31:17Z","updated_at":"2015-01-12T13:31:17Z","html_url":"https://github.com/django/django/pull/3878#discussion_r22789468","pull_request_url":"https://api.github.com/repos/django/django/pulls/3878","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/22789468"},"html":{"href":"https://github.com/django/django/pull/3878#discussion_r22789468"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/3878"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/3878","id":27152607,"html_url":"https://github.com/django/django/pull/3878","diff_url":"https://github.com/django/django/pull/3878.diff","patch_url":"https://github.com/django/django/pull/3878.patch","issue_url":"https://api.github.com/repos/django/django/issues/3878","number":3878,"state":"open","locked":false,"title":"Fixed #24092 -- Widened base field support for ArrayField.","user":{"login":"mjtamlyn","id":389581,"avatar_url":"https://avatars.githubusercontent.com/u/389581?v=3","gravatar_id":"","url":"https://api.github.com/users/mjtamlyn","html_url":"https://github.com/mjtamlyn","followers_url":"https://api.github.com/users/mjtamlyn/followers","following_url":"https://api.github.com/users/mjtamlyn/following{/other_user}","gists_url":"https://api.github.com/users/mjtamlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtamlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtamlyn/subscriptions","organizations_url":"https://api.github.com/users/mjtamlyn/orgs","repos_url":"https://api.github.com/users/mjtamlyn/repos","events_url":"https://api.github.com/users/mjtamlyn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtamlyn/received_events","type":"User","site_admin":false},"body":"Several issues resolved here, following from a report that a `base_field` of `GenericIpAddressField` was failing.\r\n\r\nWe were using `get_prep_value` instead of `get_db_prep_value` in `ArrayField` which was bypassing any extra modifications to the value being made in the base field's `get_db_prep_value`. Changing this broke datetime support, so the postgres backend has gained the relevant operation methods to send dates/times/datetimes directly to the db backend instead of casting them to strings. Similarly, a new database feature has been added allowing the uuid to be passed directly to the backend, as we do with timedeltas.\r\n\r\nOn the other side, psycopg2 expects an `Inet()` instance for ip address fields, so we add a `value_to_db_ipaddress` method to wrap the strings on postgres. We also have to manually add a database adapter to psycopg2, as we do not wish to use the built in adapter which would turn everything into `Inet()` instances.\r\n\r\nMain question: Do I need to ensure that we properly support `ArrayField(IPAddressField())` given that `IPAddressField()` is deprecated, or can the answer to the inevitable bug report be \"don't use `IPAddressField()`?","created_at":"2015-01-10T18:23:44Z","updated_at":"2015-01-12T13:31:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08bca9450c2eaaa661aa4603c1a250da8dccc162","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/3878/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/3878/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments/{number}","comments_url":"https://api.github.com/repos/django/django/issues/3878/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/f87c7bf8141e77ed25d53e2ee56a4d34c49f111d","head":{"label":"mjtamlyn:dcp-arrayfield-fixes","ref":"dcp-arrayfield-fixes","sha":"f87c7bf8141e77ed25d53e2ee56a4d34c49f111d","user":{"login":"mjtamlyn","id":389581,"avatar_url":"https://avatars.githubusercontent.com/u/389581?v=3","gravatar_id":"","url":"https://api.github.com/users/mjtamlyn","html_url":"https://github.com/mjtamlyn","followers_url":"https://api.github.com/users/mjtamlyn/followers","following_url":"https://api.github.com/users/mjtamlyn/following{/other_user}","gists_url":"https://api.github.com/users/mjtamlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtamlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtamlyn/subscriptions","organizations_url":"https://api.github.com/users/mjtamlyn/orgs","repos_url":"https://api.github.com/users/mjtamlyn/repos","events_url":"https://api.github.com/users/mjtamlyn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtamlyn/received_events","type":"User","site_admin":false},"repo":{"id":4529204,"name":"django","full_name":"mjtamlyn/django","owner":{"login":"mjtamlyn","id":389581,"avatar_url":"https://avatars.githubusercontent.com/u/389581?v=3","gravatar_id":"","url":"https://api.github.com/users/mjtamlyn","html_url":"https://github.com/mjtamlyn","followers_url":"https://api.github.com/users/mjtamlyn/followers","following_url":"https://api.github.com/users/mjtamlyn/following{/other_user}","gists_url":"https://api.github.com/users/mjtamlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtamlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtamlyn/subscriptions","organizations_url":"https://api.github.com/users/mjtamlyn/orgs","repos_url":"https://api.github.com/users/mjtamlyn/repos","events_url":"https://api.github.com/users/mjtamlyn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtamlyn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mjtamlyn/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/mjtamlyn/django","forks_url":"https://api.github.com/repos/mjtamlyn/django/forks","keys_url":"https://api.github.com/repos/mjtamlyn/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mjtamlyn/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mjtamlyn/django/teams","hooks_url":"https://api.github.com/repos/mjtamlyn/django/hooks","issue_events_url":"https://api.github.com/repos/mjtamlyn/django/issues/events{/number}","events_url":"https://api.github.com/repos/mjtamlyn/django/events","assignees_url":"https://api.github.com/repos/mjtamlyn/django/assignees{/user}","branches_url":"https://api.github.com/repos/mjtamlyn/django/branches{/branch}","tags_url":"https://api.github.com/repos/mjtamlyn/django/tags","blobs_url":"https://api.github.com/repos/mjtamlyn/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mjtamlyn/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mjtamlyn/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/mjtamlyn/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mjtamlyn/django/statuses/{sha}","languages_url":"https://api.github.com/repos/mjtamlyn/django/languages","stargazers_url":"https://api.github.com/repos/mjtamlyn/django/stargazers","contributors_url":"https://api.github.com/repos/mjtamlyn/django/contributors","subscribers_url":"https://api.github.com/repos/mjtamlyn/django/subscribers","subscription_url":"https://api.github.com/repos/mjtamlyn/django/subscription","commits_url":"https://api.github.com/repos/mjtamlyn/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/mjtamlyn/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/mjtamlyn/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/mjtamlyn/django/issues/comments/{number}","contents_url":"https://api.github.com/repos/mjtamlyn/django/contents/{+path}","compare_url":"https://api.github.com/repos/mjtamlyn/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mjtamlyn/django/merges","archive_url":"https://api.github.com/repos/mjtamlyn/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mjtamlyn/django/downloads","issues_url":"https://api.github.com/repos/mjtamlyn/django/issues{/number}","pulls_url":"https://api.github.com/repos/mjtamlyn/django/pulls{/number}","milestones_url":"https://api.github.com/repos/mjtamlyn/django/milestones{/number}","notifications_url":"https://api.github.com/repos/mjtamlyn/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mjtamlyn/django/labels{/name}","releases_url":"https://api.github.com/repos/mjtamlyn/django/releases{/id}","created_at":"2012-06-02T12:56:52Z","updated_at":"2015-01-10T16:19:13Z","pushed_at":"2015-01-12T08:30:15Z","git_url":"git://github.com/mjtamlyn/django.git","ssh_url":"git@github.com:mjtamlyn/django.git","clone_url":"https://github.com/mjtamlyn/django.git","svn_url":"https://github.com/mjtamlyn/django","homepage":"http://www.djangoproject.com/","size":101750,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"django:master","ref":"master","sha":"b5c1a85b50c709770b8e98aeecfeb8e81ca29dcf","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments/{number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","created_at":"2012-04-28T02:47:18Z","updated_at":"2015-01-12T08:19:24Z","pushed_at":"2015-01-12T08:19:24Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":242863,"stargazers_count":12535,"watchers_count":12535,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4902,"mirror_url":null,"open_issues_count":73,"forks":4902,"open_issues":73,"watchers":12535,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/3878"},"html":{"href":"https://github.com/django/django/pull/3878"},"issue":{"href":"https://api.github.com/repos/django/django/issues/3878"},"comments":{"href":"https://api.github.com/repos/django/django/issues/3878/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/3878/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/3878/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/f87c7bf8141e77ed25d53e2ee56a4d34c49f111d"}}}}