mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #20895 -- Made check management command warn if a BooleanField does not have a default value
Thanks to Collin Anderson for the suggestion and Tim Graham for reviewing the patch.
This commit is contained in:
committed by
Tim Graham
parent
55339a7669
commit
22c6497f99
@@ -63,7 +63,7 @@ class Attachment(models.Model):
|
||||
return self.content
|
||||
|
||||
class Comment(Attachment):
|
||||
is_spam = models.BooleanField()
|
||||
is_spam = models.BooleanField(default=False)
|
||||
|
||||
class Link(Attachment):
|
||||
url = models.URLField()
|
||||
@@ -96,8 +96,8 @@ class Rating(models.Model):
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Restaurant(Place, Rating):
|
||||
serves_hot_dogs = models.BooleanField()
|
||||
serves_pizza = models.BooleanField()
|
||||
serves_hot_dogs = models.BooleanField(default=False)
|
||||
serves_pizza = models.BooleanField(default=False)
|
||||
chef = models.ForeignKey(Chef, null=True, blank=True)
|
||||
|
||||
class Meta(Rating.Meta):
|
||||
@@ -108,7 +108,7 @@ class Restaurant(Place, Rating):
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ItalianRestaurant(Restaurant):
|
||||
serves_gnocchi = models.BooleanField()
|
||||
serves_gnocchi = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return "%s the italian restaurant" % self.name
|
||||
|
||||
Reference in New Issue
Block a user