Reputation: 5115
I have two models formatted as follows:
class Attachment(models.Model):
# ...
class Message(models.Model):
# ...
attachment = models.ForeignKey(Attachment, blank=True, default=None, null=True)
# ...
I have tried various solutions found every where online...but cannot make it work! Here are some of the combinations I have tried:
I keep getting the following error whenever I try to save a message with no attachment.
IntegrityError: myapp_message.attachment_id may not be NULL
I am using SQLite if that is significant. Why isn't what I am doing working?
Upvotes: 0
Views: 333
Reputation: 24921
did you modify your model after doing syncdb
? If that's the case, you should delete your table and syncdb
again.
Upvotes: 1