Skip to content

Commit 6947885

Browse files
olasitarskatimgraham
authored andcommitted
Fixed #23283 -- Added default=False to BooleanField's in the docs.
Thanks Baptiste for the suggestion.
1 parent e537699 commit 6947885

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

docs/releases/1.7.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class method can now directly :ref:`create Manager with QuerySet methods
185185

186186
class Food(models.Model):
187187
kind = models.CharField(max_length=50)
188-
vegetarian = models.BooleanField()
188+
vegetarian = models.BooleanField(default=False)
189189
objects = FoodQuerySet.as_manager()
190190

191191
Food.objects.pizzas().vegetarian()

docs/topics/db/examples/one_to_one.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ In this example, a ``Place`` optionally can be a ``Restaurant``:
2121

2222
class Restaurant(models.Model):
2323
place = models.OneToOneField(Place, primary_key=True)
24-
serves_hot_dogs = models.BooleanField()
25-
serves_pizza = models.BooleanField()
24+
serves_hot_dogs = models.BooleanField(default=False)
25+
serves_pizza = models.BooleanField(default=False)
2626

2727
def __str__(self): # __unicode__ on Python 2
2828
return "%s the restaurant" % self.place.name

docs/topics/db/models.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,8 @@ For example::
10061006
address = models.CharField(max_length=80)
10071007

10081008
class Restaurant(Place):
1009-
serves_hot_dogs = models.BooleanField()
1010-
serves_pizza = models.BooleanField()
1009+
serves_hot_dogs = models.BooleanField(default=False)
1010+
serves_pizza = models.BooleanField(default=False)
10111011

10121012
All of the fields of ``Place`` will also be available in ``Restaurant``,
10131013
although the data will reside in a different database table. So these are both

docs/topics/serialization.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ model will be serialized. For example, consider the following models::
8484
name = models.CharField(max_length=50)
8585

8686
class Restaurant(Place):
87-
serves_hot_dogs = models.BooleanField()
87+
serves_hot_dogs = models.BooleanField(default=False)
8888

8989
If you only serialize the Restaurant model::
9090

0 commit comments

Comments
 (0)