Reputation: 23
I use the default comment form in django as the document.But the tages like "name","url" aren`t suit my need.I need them become chinese.How can I change these tages and How to custom form with the comment framework?Please help me.Thanks a lot.
And I custom the form but it doesn't work.
form.py:
class CommentFormmodels(CommentForm):
name = forms.CharField(label=("姓名"), max_length=50)
email = forms.EmailField(label=("Email address"))
url = forms.URLField(label=("个人站点")`enter code here`, required=False)
comment = forms.CharField(label=('评论'), widget=forms.Textarea,
max_length=COMMENT_MAX_LENGTH)
def get_comment_model(self):
return CommentForm
def get_comment_create_data(self):
data = super(CommentFormmodels,self).get_comment_create_data()
data['name']=self.cleaned_data['name']
data['email'] = self.cleaned_data['email']
data['url'] = self.cleaned_data['url']
data['comment'] = self.cleaned_data['comment']
return data
__init__.py:
from comment.forms import CommentFormmodels
def get_fom():
return CommentFormmodels
Upvotes: 0
Views: 1197
Reputation: 3631
https://docs.djangoproject.com/en/1.4/ref/contrib/comments/custom/
You need to create your comments app, create new form from CommentForm and change labels in it.
Upvotes: 1
Reputation: 1452
Have a look at the labels section: https://docs.djangoproject.com/en/dev/ref/forms/fields/#label
Upvotes: 0