diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-04-20 22:34:28 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-04-20 22:45:20 +0800 |
commit | 8fd9086f337a09125ddcfaa616e762a4d85c6000 (patch) | |
tree | 0184d09f754afb76d835bd20631cfffa137c7c0b /apps/patchwork/forms.py | |
parent | 5d0140ef04ababd93c45b5126ee1b412bd778da5 (diff) | |
download | patchwork-8fd9086f337a09125ddcfaa616e762a4d85c6000.tar.bz2 patchwork-8fd9086f337a09125ddcfaa616e762a4d85c6000.tar.xz |
bundles: Don't allow slashes in bundle names
Because bundle names are used in URLs, we don't want slashes in them.
Include a SQL migration script.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/forms.py')
-rw-r--r-- | apps/patchwork/forms.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/patchwork/forms.py b/apps/patchwork/forms.py index d5e51a2..8219769 100644 --- a/apps/patchwork/forms.py +++ b/apps/patchwork/forms.py @@ -58,11 +58,14 @@ class LoginForm(forms.Form): password = forms.CharField(widget = forms.PasswordInput) class BundleForm(forms.ModelForm): + name = forms.RegexField(regex = r'^[^/]+$', max_length=50, label=u'Name', + error_messages = {'invalid': 'Bundle names can\'t contain slashes'}) + class Meta: model = Bundle fields = ['name', 'public'] -class CreateBundleForm(forms.ModelForm): +class CreateBundleForm(BundleForm): def __init__(self, *args, **kwargs): super(CreateBundleForm, self).__init__(*args, **kwargs) |