Can a field of type models.PositiveIntegerField contain a 0 value? I'm doing something like:
points = models.PositiveIntegerField(default=0)
Thanks,
I know I should try ir myself, but I haven't a Django environment here.
PositiveIntegerField is a integer number represented in Python by a int instance. This field is like a IntegerField but must be either positive or zero (0). The default form widget for this field is a NumberInput when localize is False or TextInput otherwise.
null. If True , Django will store empty values as NULL in the database. Default is False .
For example, adding an argument null = True to IntegerField will enable it to store empty values for that table in relational database. Here are the field options and attributes that an IntegerField can use. If True, Django will store empty values as NULL in the database.
@Raphael In a migration, an auto_created model gets created by the AddField operation for the ManyToManyField -- it does not exist as a separate model, only as part of the model that defines the m2m field.
Yes, it can. It is debatable whether it should--there is a longstanding bug report: http://code.djangoproject.com/ticket/7609
Yes.
The model field reference says so. For completeness, also quoted here:
PositiveIntegerField
class PositiveIntegerField([**options])
Like an IntegerField, but must be either positive or zero (0). The value 0 is accepted for backward compatibility reasons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With