summaryrefslogtreecommitdiff
path: root/django/db/backends/base
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2017-12-11 15:36:33 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-08-20 09:22:25 +0200
commit21e559495b8255bba1e8a4429cd083246ab90457 (patch)
tree7c28928a42b896f05be9282461dcc0e1db08c03e /django/db/backends/base
parentb10d322c41f66dc7c77c36f90a3532269b25ea93 (diff)
Fixed #29979, Refs #17337 -- Extracted AutoField field logic into a mixin and refactored AutoFields.
This reduces duplication by allowing AutoField, BigAutoField and SmallAutoField to inherit from IntegerField, BigIntegerField and SmallIntegerField respectively. Doing so also allows for enabling the max_length warning check and minimum/maximum value validation for auto fields, as well as providing a mixin that can be used for other possible future auto field types such as a theoretical UUIDAutoField.
Diffstat (limited to 'django/db/backends/base')
-rw-r--r--django/db/backends/base/operations.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
index d17dc8dcce..76abc6dcb2 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -26,6 +26,9 @@ class BaseDatabaseOperations:
'BigIntegerField': (-9223372036854775808, 9223372036854775807),
'PositiveSmallIntegerField': (0, 32767),
'PositiveIntegerField': (0, 2147483647),
+ 'SmallAutoField': (-32768, 32767),
+ 'AutoField': (-2147483648, 2147483647),
+ 'BigAutoField': (-9223372036854775808, 9223372036854775807),
}
set_operators = {
'union': 'UNION',