1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-28 03:31:23 +00:00
seahub/organizations/forms.py

20 lines
782 B
Python
Raw Normal View History

2012-07-26 09:08:31 +00:00
# encoding: utf-8
from django import forms
from seaserv import ccnet_threaded_rpc
class OrgCreateForm(forms.Form):
org_name = forms.CharField(max_length=256,
widget=forms.TextInput(),
label="Organization Name")
url_prefix = forms.RegexField(label="Url Prefix", max_length=20,
regex=r'^[a-z0-9]+$',
2012-08-03 03:37:29 +00:00
error_message="个性域名只能包含字母或数字")
2012-07-26 09:08:31 +00:00
def clean_url_prefix(self):
url_prefix = self.cleaned_data['url_prefix']
org = ccnet_threaded_rpc.get_org_by_url_prefix(url_prefix)
if not org:
return url_prefix
else:
2012-08-03 03:37:29 +00:00
raise forms.ValidationError("该个性域名已被注册")