﻿id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 16251 "Db/Models: distinction btw ""null"" and ""blank""" John Chandler nobody "In the 1.3 doc (https://docs.djangoproject.com/en/1.3/topics/db/models/), some distinctions are drawn between allowing/disallowing null in the database and allowing/disallowing blank on data-entry: ==== null If True, Django will store empty values as NULL in the database. Default is False. blank If True, the field is allowed to be blank. Default is False. Note that this is different than null. null is purely database-related, whereas blank is validation-related. If a field has blank=True, validation on Django's admin site will allow entry of an empty value. If a field has blank=False, the field will be required. ==== This leaves me, and I suspect at least some other newbies, wondering what happens if 1. blank is allowed on data-entry, 2. null is not allowed in the database, and 3. a user leaves a field blank. Is the input rejected? Is a default, non-null value inserted? Are developers advised not to allow conditions 1. and 2. both to apply in the same instance? It occurs to me that this might have been intentionally ""left as an exercise for the reader,"" but I'd suggest that approach would be more correct in the tutorial than in the ref. " Uncategorized closed Documentation 1.3 Normal invalid john.chandler@… Unreviewed 0 0 0 0 0 0