1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-10-21 19:00:12 +00:00
Files
seahub/profile/forms.py

17 lines
571 B
Python
Raw Normal View History

2012-06-21 20:53:13 +08:00
# encoding: utf-8
from django import forms
2013-01-17 11:01:00 +08:00
from django.utils.translation import ugettext_lazy as _
2012-06-21 20:53:13 +08:00
from seahub.utils import validate_group_name
2012-06-21 20:53:13 +08:00
class ProfileForm(forms.Form):
2012-06-21 22:48:06 +08:00
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
2012-06-21 20:53:13 +08:00
def clean_nickname(self):
nickname = self.cleaned_data['nickname']
if validate_group_name(nickname):
return nickname
else:
2013-01-17 11:01:00 +08:00
raise forms.ValidationError(_(u'Nickname can only contain characters, numbers or underscore.'))