django python blank=True still required
django, field, python
Solution
You have to add the `null=True` argument on the field definition, preferably before a syncdb (or you can migrate with South)
skill = models.ForeignKey(Skill, blank=True, null=True)
Problem
In the code below, somehow the fields that have `blank=True` are still required and cannot be `Null` Example: ``` # Skill train timer class SkillTrainingTimer(models.Model): """ Character Training timer, keep track fo what skill is in training, and when it is done """ character = models.ForeignKey(Character, unique=True) skill = models.ForeignKey(Skill, blank=True) trainingground = models.ForeignKey(TrainingGround, verbose_name='Training ground') timer = models.DateTimeField() ``` and now i do: ``` train_skill = SkillTrainingTimer( character=some_character_obj, trainingground=some_trainingground_obj, timer = fatetime.datetime.now() ) train_skill.save() ``` It starts complaining skill cannot be `Null`. I have this in a lot of models and functions and so far i just dumped some useless data in it.