From patchwork Fri Mar 25 17:27:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 602073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qWqyT5wSRz9s8d for ; Sat, 26 Mar 2016 04:28:17 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3qWqyT4wxlzDq7K for ; Sat, 26 Mar 2016 04:28:17 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lists.ozlabs.org (Postfix) with ESMTP id 3qWqxh33jFzDq5k for ; Sat, 26 Mar 2016 04:27:35 +1100 (AEDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 25 Mar 2016 10:27:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,392,1455004800"; d="scan'208";a="675609920" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 25 Mar 2016 10:27:33 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u2PHRXcQ000815; Fri, 25 Mar 2016 17:27:33 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u2PHRWq1029739; Fri, 25 Mar 2016 17:27:32 GMT Received: (from sfinucan@localhost) by sivswdev01.ir.intel.com with id u2PHRWJL029735; Fri, 25 Mar 2016 17:27:32 GMT From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH v2 2/6] models: Use non-null slugs for 'Check.name' Date: Fri, 25 Mar 2016 17:27:19 +0000 Message-Id: <1458926843-29681-2-git-send-email-stephen.finucane@intel.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1458926843-29681-1-git-send-email-stephen.finucane@intel.com> References: <1458926843-29681-1-git-send-email-stephen.finucane@intel.com> X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The schema for 'Check' defines 'Check.name' as a 'CharField'. This is less than ideal as names with spaces and special characters can't be represented cleanly in URLs etc. We should use 'SlugField' instead. Signed-off-by: Stephen Finucane Closes: #33 --- patchwork/migrations/0009_slugified_check_context | 19 +++++++++++++++++++ patchwork/models.py | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 patchwork/migrations/0009_slugified_check_context diff --git a/patchwork/migrations/0009_slugified_check_context b/patchwork/migrations/0009_slugified_check_context new file mode 100644 index 0000000..7916f7c --- /dev/null +++ b/patchwork/migrations/0009_slugified_check_context @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('patchwork', '0008_add_email_mixin'), + ] + + operations = [ + migrations.AlterField( + model_name='check', + name='context', + field=models.SlugField(default=b'default', help_text=b'A label to discern check from checks of other testing systems.', max_length=255), + ), + ] diff --git a/patchwork/models.py b/patchwork/models.py index 87d7d0d..267c08e 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -552,12 +552,12 @@ class Check(models.Model): help_text='The state of the check.') target_url = models.URLField( blank=True, null=True, - help_text='The target URL to associate with this check. This should' - ' be specific to the patch.') + help_text='The target URL to associate with this check. This should ' + 'be specific to the patch.') description = models.TextField( blank=True, null=True, help_text='A brief description of the check.') - context = models.CharField( - max_length=255, default='default', blank=True, null=True, + context = models.SlugField( + max_length=255, default='default', help_text='A label to discern check from checks of other testing ' 'systems.')