Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/933969/?format=api
{ "id": 933969, "url": "http://patchwork.ozlabs.org/api/patches/933969/?format=api", "web_url": "http://patchwork.ozlabs.org/project/patchwork/patch/20180624195557.19909-3-stephen@that.guru/", "project": { "id": 16, "url": "http://patchwork.ozlabs.org/api/projects/16/?format=api", "name": "Patchwork", "link_name": "patchwork", "list_id": "patchwork.lists.ozlabs.org", "list_email": "patchwork@lists.ozlabs.org", "web_url": "http://jk.ozlabs.org/projects/patchwork/", "scm_url": "git://github.com/getpatchwork/patchwork", "webscm_url": "https://github.com/getpatchwork/patchwork", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20180624195557.19909-3-stephen@that.guru>", "list_archive_url": null, "date": "2018-06-24T19:55:49", "name": "[03/11] Add support for django-filter 1.1", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "9807ea36d056fdc2eaade2d67ee70e3386dbeca8", "submitter": { "id": 69991, "url": "http://patchwork.ozlabs.org/api/people/69991/?format=api", "name": "Stephen Finucane", "email": "stephen@that.guru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/patchwork/patch/20180624195557.19909-3-stephen@that.guru/mbox/", "series": [ { "id": 51752, "url": "http://patchwork.ozlabs.org/api/series/51752/?format=api", "web_url": "http://patchwork.ozlabs.org/project/patchwork/list/?series=51752", "date": "2018-06-24T19:55:49", "name": "[01/11] REST: Check.user is not read-only", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/51752/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/933969/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/933969/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "patchwork@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "patchwork@lists.ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 41DNNK1VxQz9ry1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Jun 2018 05:56:17 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 41DNNJ6kZ9zF14s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Jun 2018 05:56:16 +1000 (AEST)", "from fossa.birch.relay.mailchannels.net\n\t(fossa.birch.relay.mailchannels.net [23.83.209.62])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 41DNND4wXwzF14g\n\tfor <patchwork@lists.ozlabs.org>;\n\tMon, 25 Jun 2018 05:56:11 +1000 (AEST)", "from relay.mailchannels.net (localhost [127.0.0.1])\n\tby relay.mailchannels.net (Postfix) with ESMTP id 7A87E5E1391\n\tfor <patchwork@lists.ozlabs.org>;\n\tSun, 24 Jun 2018 19:56:08 +0000 (UTC)", "from one.mxroute.com (unknown [100.96.26.53])\n\t(Authenticated sender: 5xi41l16bi)\n\tby relay.mailchannels.net (Postfix) with ESMTPA id 6DEAF5E133F\n\tfor <patchwork@lists.ozlabs.org>;\n\tSun, 24 Jun 2018 19:56:06 +0000 (UTC)", "from one.mxroute.com (one-outgoing.mxroute.com [172.19.51.240])\n\t(using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)\n\tby 0.0.0.0:2500 (trex/5.15.2); Sun, 24 Jun 2018 19:56:08 +0000" ], "Authentication-Results": [ "ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=that.guru", "ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=that.guru header.i=@that.guru\n\theader.b=\"eMcA6Q2r\"; dkim-atps=neutral", "lists.ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=that.guru", "lists.ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=that.guru header.i=@that.guru\n\theader.b=\"eMcA6Q2r\"; dkim-atps=neutral", "lists.ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=that.guru\n\t(client-ip=23.83.209.62; helo=fossa.birch.relay.mailchannels.net;\n\tenvelope-from=stephen@that.guru; receiver=<UNKNOWN>)", "lists.ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=that.guru", "lists.ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=that.guru header.i=@that.guru\n\theader.b=\"eMcA6Q2r\"; dkim-atps=neutral" ], "X-Sender-Id": [ "5xi41l16bi|x-authuser|stephen@that.guru", "5xi41l16bi|x-authuser|stephen@that.guru" ], "X-MC-Relay": "Neutral", "X-MailChannels-SenderId": "5xi41l16bi|x-authuser|stephen@that.guru", "X-MailChannels-Auth-Id": "5xi41l16bi", "X-Duck-Cure": "3bbd64fe0fa19296_1529870166656_1926436379", "X-MC-Loop-Signature": "1529870166656:4262772492", "X-MC-Ingress-Time": "1529870166656", "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru;\n\ts=default;\n\th=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:\n\tSender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:\n\tContent-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:\n\tResent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:\n\tList-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=m2vkttr/PuCTQJDs2nSSQ52PCyt+bxMMHTCgAgCW5T0=;\n\tb=eMcA6Q2rZf3rDEJMUJgbOmUuOH\n\tTgWrI3fphEZmPyk2HQ1MWpm3Jxhp+K6/492Y3YYF2pUncbLVc2luOoVMZ617q9p7ghDvoA0bhZbs1\n\tTiViZQXLnif6cgUSh9zmV0hF/PZBOrEL39AHjeWhU11FNbJJvjOiyXq6Tqi/ySNC3f6bOIw7g97TY\n\tad9lF/izArY+e3W4BANjIltdFC2A9idu7pkIpZbMTVVBFUweb8ZnUOU4T+N+k7eB78p+ew2WcPwRh\n\tIfDhJgpIIsuEvmptELWiVtHyBEdRpPIaL0Wh7x4jxDW9u8ym9o9bJQ5STeILHtO0j9wgnDsLf3N+l\n\tiC7ZIkCQ==;", "From": "Stephen Finucane <stephen@that.guru>", "To": "patchwork@lists.ozlabs.org", "Subject": "[PATCH 03/11] Add support for django-filter 1.1", "Date": "Sun, 24 Jun 2018 20:55:49 +0100", "Message-Id": "<20180624195557.19909-3-stephen@that.guru>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20180624195557.19909-1-stephen@that.guru>", "References": "<20180624195557.19909-1-stephen@that.guru>", "X-AuthUser": "stephen@that.guru", "X-BeenThere": "patchwork@lists.ozlabs.org", "X-Mailman-Version": "2.1.26", "Precedence": "list", "List-Id": "Patchwork development <patchwork.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/patchwork>,\n\t<mailto:patchwork-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/patchwork/>", "List-Post": "<mailto:patchwork@lists.ozlabs.org>", "List-Help": "<mailto:patchwork-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/patchwork>,\n\t<mailto:patchwork-request@lists.ozlabs.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org", "Sender": "\"Patchwork\"\n\t<patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>" }, "content": "There's one warning to handle here.\n\nSigned-off-by: Stephen Finucane <stephen@that.guru>\n---\n README.rst | 2 +-\n patchwork/api/filters.py | 5 +++--\n patchwork/compat.py | 17 +++++++++++++++++\n .../django-filter-1-1-6a6b0ab8cbe0faca.yaml | 6 ++++++\n requirements-dev.txt | 2 +-\n requirements-prod.txt | 2 +-\n tox.ini | 3 ++-\n 7 files changed, 31 insertions(+), 6 deletions(-)\n create mode 100644 releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml", "diff": "diff --git a/README.rst b/README.rst\nindex ddc4b981..94ac32c3 100644\n--- a/README.rst\n+++ b/README.rst\n@@ -47,7 +47,7 @@ Requirements\n \n - Django REST Framework (3.4 - 3.8)\n \n-- Django Filters (1.0)\n+- Django Filters (1.0 - 1.1)\n \n Development Installation\n ------------------------\ndiff --git a/patchwork/api/filters.py b/patchwork/api/filters.py\nindex 73353d90..ddf527fd 100644\n--- a/patchwork/api/filters.py\n+++ b/patchwork/api/filters.py\n@@ -26,6 +26,7 @@ from django_filters import ModelMultipleChoiceFilter\n from django.forms import ModelMultipleChoiceField as BaseMultipleChoiceField\n from django.forms.widgets import MultipleHiddenInput\n \n+from patchwork.compat import NAME_FIELD\n from patchwork.models import Bundle\n from patchwork.models import Check\n from patchwork.models import CoverLetter\n@@ -151,8 +152,8 @@ class UserFilter(ModelMultipleChoiceFilter):\n class TimestampMixin(FilterSet):\n \n # TODO(stephenfin): These should filter on a 'updated_at' field instead\n- before = IsoDateTimeFilter(name='date', lookup_expr='lt')\n- since = IsoDateTimeFilter(name='date', lookup_expr='gte')\n+ before = IsoDateTimeFilter(lookup_expr='lt', **{NAME_FIELD: 'date'})\n+ since = IsoDateTimeFilter(lookup_expr='gte', **{NAME_FIELD: 'date'})\n \n \n class SeriesFilterSet(TimestampMixin, FilterSet):\ndiff --git a/patchwork/compat.py b/patchwork/compat.py\nindex 38caa4e8..e74e9264 100644\n--- a/patchwork/compat.py\n+++ b/patchwork/compat.py\n@@ -41,6 +41,23 @@ if settings.ENABLE_REST_API:\n from rest_framework.filters import DjangoFilterBackend # noqa\n \n \n+# NAME_FIELD\n+#\n+# The django-filter library renamed 'Filter.name' to 'Filter.field_name' in\n+# 1.1.\n+#\n+# https://django-filter.readthedocs.io/en/master/guide/migration.html\\\n+# #migrating-to-2-0\n+\n+if settings.ENABLE_REST_API:\n+ import django_filters # noqa\n+\n+ if django_filters.VERSION >= (1, 1):\n+ NAME_FIELD = 'field_name'\n+ else:\n+ NAME_FIELD = 'name'\n+\n+\n # reverse, reverse_lazy\n #\n # The reverse and reverse_lazy functions have been moved to django.urls in\ndiff --git a/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml b/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml\nnew file mode 100644\nindex 00000000..3beb9c08\n--- /dev/null\n+++ b/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml\n@@ -0,0 +1,6 @@\n+---\n+upgrade:\n+ - |\n+ `django-filter 1.1\n+ <https://github.com/carltongibson/django-filter/releases/tag/1.1.0>`_ is\n+ now supported.\ndiff --git a/requirements-dev.txt b/requirements-dev.txt\nindex b12246dd..1d58df71 100644\n--- a/requirements-dev.txt\n+++ b/requirements-dev.txt\n@@ -1,4 +1,4 @@\n Django>=1.8,<2.0\n djangorestframework>=3.4,<3.9\n-django-filter>=1.0,<1.1\n+django-filter>=1.0,<1.2\n -r requirements-test.txt\ndiff --git a/requirements-prod.txt b/requirements-prod.txt\nindex 42ff8ecd..59e2c1e6 100644\n--- a/requirements-prod.txt\n+++ b/requirements-prod.txt\n@@ -1,5 +1,5 @@\n Django>=1.8,<2.0\n djangorestframework>=3.4,<3.9\n-django-filter>=1.0,<1.1\n+django-filter>=1.0,<1.2\n psycopg2>=2.7,<2.8\n sqlparse==0.2.4\ndiff --git a/tox.ini b/tox.ini\nindex c1bc64e3..9aac8247 100644\n--- a/tox.ini\n+++ b/tox.ini\n@@ -13,7 +13,8 @@ deps =\n django{18,19}: djangorestframework>=3.4,<3.7\n django110: djangorestframework>=3.4,<3.9\n django111: djangorestframework>=3.6,<3.9\n- django{18,19,110,111}: django-filter>=1.0,<1.1\n+ django18: django-filter>=1.0,<1.1\n+ django{19,110,111}: django-filter>=1.0,<1.2\n setenv =\n DJANGO_SETTINGS_MODULE = patchwork.settings.dev\n PYTHONDONTWRITEBYTECODE = 1\n", "prefixes": [ "03/11" ] }