我在尝试重写Django ModelForm字段时遇到了问题。重写Django ModelForm字段时出错
我的models.py是这样的:
from django.db import models
class CadastroParticipantes(models.Model):
nome = models.CharField(max_length=50)
sobrenome = models.CharField(max_length=100)
cpf = models.CharField(max_length=14)
email = models.EmailField(max_length=100)
num_cartas_solicitadas = models.IntegerField(default=0)
def __unicode__(self):
return self.email
而且我forms.py是这样的:
from django.forms import ModelForm
from models import *
class FormCadastroParticipante(ModelForm):
class Meta:
model = CadastroParticipantes
fields = ('nome', 'sobrenome', 'cpf', 'email')
exclude=('num_cartas_solicitadas')
widgets = { 'nome' : attrs={'title': 'Seu primeiro nome.'}}
当我运行的服务器,并尝试访问我得到这个消息:
**
SyntaxError at/
invalid syntax (forms.py, line 9)
**
有人可以帮助我吗?
在此先感谢所有! (Y)
谢谢你!它非常完美! :) –