mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 23:29:49 +00:00
Modify org
This commit is contained in:
19
organizations/forms.py
Normal file
19
organizations/forms.py
Normal 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("该域名前缀已被注册")
|
Reference in New Issue
Block a user