Django Models Number Field

One of the cool things about Django that it provides you with different types of models read about them here.

For your case try something like this

number = models.IntegerField()

You can read more about the IntegerField here


Player's shirt numbers should need only positive numbers.

PositiveBigIntegerField allows values from 0 to 9223372036854775807:

number = models.PositiveBigIntegerField()

PositiveIntegerField allows values from 0 to 2147483647:

number = models.PositiveIntegerField()

PositiveSmallIntegerField allows values from 0 to 32767:

number = models.PositiveSmallIntegerField()

In addition, there are no "NegativeIntegerField", "NegativeBigIntegerField" and "NegativeSmallIntegerField" in Django.

Tags:

Django

Models