我有一个表单,希望不显示用户字段。
模型.py
class Questions(models.Model):
user=models.ForeignKey(User)
category=models.ForeignKey(Categories)
question=models.TextField(max_length=500)
created_date=models.DateTimeField('date created')
def __unicode__(self):
return "%s%s" %(self.question,self.created_date)
class QuestionsForm(ModelForm):
class Meta:
model = Questions
widgets = {
'question': TextInput(attrs={'placeholder': 'Add question here'})
}
exclude=('user',)
我尝试排除但该字段仍然出现。怎么做??