我正在使用django框架开发应用程序。
我有一个包含以下字段的模型:
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=1, null=True, blank=True)
text = models.TextField()
created_date = models.DateTimeField(
default=timezone.now)
published_date = models.DateTimeField(
blank=True, null=True)
#forms.py
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ('title', 'text',)
def __init__(self, *args, **kwargs):
super(PostForm, self).__init__(*args, **kwargs)
self.fields['title'].widget = #what to put here ?
对于标题字段,我只想在斜体显示help_text而不是CharField输入。 Django允许这样做吗?