On Nov 7, 1:57 pm, PeteDK <[EMAIL PROTECTED]> wrote: > Hiii everybody... > > I am trying to create this class called "car". > In this car class i have an IntegerField "year". The thing is, this > field should not be required and therefor the user should not be > "forced" to enter anything into this field if the person doesn't want > to. > > However i can't seem to ignore this field?? > > When i try to say "year = pass", "year=None" or anything like that i > get an error. > > For several reasons, I am not interested in just giving this field the > number "0" or something like that... I would really like this field to > be just blank/null/none if the user does not enter anything into this > form-field. > > Do you know any way around this? Am i missing an optional argument in > my models.py class or forms.py class??? Or is it simply not possible > with an IntegerField. > > If it isn't possible, can i then use som "trick" to get these "blank" > fields?? > > kind regards.. > > Peter Møller
You need to have null=True in your model field delcaration: year = models.IntegerField(blank=True, null=True) -- DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---