Thanks for that, but I still get the error message: Exception Type: IntegrityError Exception Value: invoice_invoice.payed_at may not be NULL
here my models.py: from django.db import models class Customer(models.Model): company = models.CharField(max_length=255) branch = models.CharField(max_length=255) firstname = models.CharField(max_length=255) lastname = models.CharField(max_length=255) street = models.CharField(max_length=255) zip = models.CharField(max_length=6) country = models.CharField(max_length=255) email = models.CharField(max_length=255) created_at = models.DateTimeField('date created') def __unicode__(self): return self.company class Project(models.Model): title = models.CharField(max_length=255); created_at = models.DateTimeField('date created') def __unicode__(self): return self.title class Invoice(models.Model): customer = models.ForeignKey(Customer) project = models.ForeignKey(Project, null=True) sum = models.FloatField(default=0) tax = models.IntegerField(default=16) payed_at = models.DateTimeField(default=None) payable_at = models.DateField('payable at') created_at = models.DateTimeField(False, True) class InvoiceItem(models.Model): invoice = models.ForeignKey(Invoice) text = models.TextField() unit = models.CharField(max_length=255) amount = models.IntegerField() sum = models.FloatField() On 21 Aug., 15:19, dm03514 <dm03...@gmail.com> wrote: > you can set default=None, that way you don't have to explicityly save > that value as none every time you save an object. > > On Aug 21, 7:33 am, Torsten <torstenzan...@googlemail.com> wrote: > > > > > > > > > Hi > > > I simply want the DateTime to be set to null. > > > payed_at = models.DateTimeField(null=True) > > > but always get this as an error: > > > IntegrityError at /admin/invoice/invoice/add/ > > invoice_invoice.payed_at may not be NULL > > > Thanks for help. > > > Torsten -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.