Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRey Adronico Baguio
13,672 PointsDo we need to input both blank and default?
Question: I understand why we had an error when we tried to do a migration on a field that's not nullable (like the content Text Field). That meant we had to set a default either via the python shell or via the python script itself. But why did we have to set blank = True? Couldn't we leave it as just:
content = models.TextField(default='')? So it's always set as a empty string when there are no inputs in it?
I'm sure I'm missing something so I would just like to understand what I'm missing :)
1 Answer
Chris Freeman
Treehouse Moderator 68,454 PointsThe blank=True
is used to tell the Form generator to allow a blank entry for this field on POST data.