diff options
author | Stephen Finucane <stephen.finucane@intel.com> | 2016-06-24 17:28:12 +0100 |
---|---|---|
committer | Stephen Finucane <stephen.finucane@intel.com> | 2016-06-28 10:16:10 +0100 |
commit | c5b9ca05fe905666d7f1ab90d655b5881b7c22e4 (patch) | |
tree | 4d7cb7b35c3931b422f3a2d8b6558a15dc051929 | |
parent | dbdc58e3d7334bd32b52ef0a39111afadcae61ab (diff) | |
download | patchwork-c5b9ca05fe905666d7f1ab90d655b5881b7c22e4.tar patchwork-c5b9ca05fe905666d7f1ab90d655b5881b7c22e4.tar.gz |
models: Use non-null slugs for 'Check.name'
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 <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
Closes: #33
-rw-r--r-- | patchwork/migrations/0013_slug_check_context.py | 19 | ||||
-rw-r--r-- | patchwork/models.py | 8 |
2 files changed, 23 insertions, 4 deletions
diff --git a/patchwork/migrations/0013_slug_check_context.py b/patchwork/migrations/0013_slug_check_context.py new file mode 100644 index 0000000..17e33aa --- /dev/null +++ b/patchwork/migrations/0013_slug_check_context.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('patchwork', '0012_add_coverletter_model'), + ] + + 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 6209527..0ddb409 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -581,12 +581,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.') |