Following the database API reference (http://www.djangoproject.com/
documentation/db-api/):
If a ForeignKey field has null=True set (i.e., it allows
NULL values), you can assign None to it. Example:
e = Entry.objects.get(id=2)
e.blog = None
e.save() # "UPDATE blog_entry SET blog_id = NULL ...;"
I want to know what is equivalent to Blank? That is, how to set
e.blog to blank if blank=True?
Thanks,
Xan.
blank=True has absolutely nothing to do with the database, as the
documentation for it clearly states :)
It merely makes it so you can give it no value in form validation,
like in admin.
Well, thanks,
I will change all my blank=True for null=True
Thanks a lot,
Xan.
blank=True will tell admin to let you pick nothing for it, and
null=True will then allow the NULL value to be entered.
NULL is what you use to signify "unset" on a ForeignKey