1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 23:29:49 +00:00

Modify org

This commit is contained in:
xiez
2012-07-26 17:08:31 +08:00
parent 0207e1e162
commit 0132e4e85d
34 changed files with 538 additions and 41 deletions

19
organizations/forms.py Normal file
View File

@@ -0,0 +1,19 @@
# 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]+$',
error_message="域名前缀只能包含字母或数字")
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:
raise forms.ValidationError("该域名前缀已被注册")