mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +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:
parent
55339a7669
commit
22c6497f99
23 changed files with 111 additions and 42 deletions
|
@ -117,7 +117,7 @@ class OwnerProfile(models.Model):
|
|||
|
||||
@python_2_unicode_compatible
|
||||
class Restaurant(Place):
|
||||
serves_pizza = models.BooleanField()
|
||||
serves_pizza = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -141,11 +141,11 @@ class Price(models.Model):
|
|||
unique_together = (('price', 'quantity'),)
|
||||
|
||||
class MexicanRestaurant(Restaurant):
|
||||
serves_tacos = models.BooleanField()
|
||||
serves_tacos = models.BooleanField(default=False)
|
||||
|
||||
class ClassyMexicanRestaurant(MexicanRestaurant):
|
||||
restaurant = models.OneToOneField(MexicanRestaurant, parent_link=True, primary_key=True)
|
||||
tacos_are_yummy = models.BooleanField()
|
||||
tacos_are_yummy = models.BooleanField(default=False)
|
||||
|
||||
# models for testing unique_together validation when a fk is involved and
|
||||
# using inlineformset_factory.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue