I am having trouble when I try to override a Django ModelForm fields.
My models.py is like this:
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
And my forms.py is like this:
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.'}}
When I run the server and try to access I get this message:
**
SyntaxError at /
invalid syntax (forms.py, line 9)
**
can someone help me on this?
Thanks in advance to all! (Y)
You have forgot to specify a widget class. It should be something like this:
Change
TextInputto your desired widget class. Please also note thatexcludeattribute inMetaclass accept a list, don’t forget a trailing comma if there is only one list member.