1 | Index: django_src/django/core/formfields.py
|
---|
2 | ===================================================================
|
---|
3 | --- django_src/django/core/formfields.py (revision 569)
|
---|
4 | +++ django_src/django/core/formfields.py (working copy)
|
---|
5 | @@ -544,6 +544,15 @@
|
---|
6 | if not -32768 <= int(field_data) <= 32767:
|
---|
7 | raise validators.CriticalValidationError, "Enter a whole number between -32,768 and 32,767."
|
---|
8 |
|
---|
9 | +class BigIntegerField(IntegerField):
|
---|
10 | + def __init__(self, field_name, length=15, maxlength=20, is_required=False, validator_list=[]):
|
---|
11 | + validator_list = [self.isBigInteger] + validator_list
|
---|
12 | + IntegerField.__init__(self, field_name, length, maxlength, is_required, validator_list)
|
---|
13 | +
|
---|
14 | + def isBigInteger(self, field_data, all_data):
|
---|
15 | + if not -9223372036854775808 <= int(field_data) <= 9223372036854775807:
|
---|
16 | + raise validators.CriticalValidationError, "Enter a whole number between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807."
|
---|
17 | +
|
---|
18 | class PositiveIntegerField(IntegerField):
|
---|
19 | def __init__(self, field_name, length=10, maxlength=None, is_required=False, validator_list=[]):
|
---|
20 | validator_list = [self.isPositive] + validator_list
|
---|
21 | @@ -562,6 +571,15 @@
|
---|
22 | if not 0 <= int(field_data) <= 32767:
|
---|
23 | raise validators.CriticalValidationError, "Enter a whole number between 0 and 32,767."
|
---|
24 |
|
---|
25 | +class PositiveBigIntegerField(IntegerField):
|
---|
26 | + def __init__(self, field_name, length=15, maxlength=20, is_required=False, validator_list=[]):
|
---|
27 | + validator_list = [self.isPositiveBig] + validator_list
|
---|
28 | + IntegerField.__init__(self, field_name, length, maxlength, is_required, validator_list)
|
---|
29 | +
|
---|
30 | + def isPositiveBig(self, field_data, all_data):
|
---|
31 | + if not 0 <= int(field_data) <= 18446744073709551615:
|
---|
32 | + raise validators.CriticalValidationError, "Enter a whole number between 0 and 18,446,744,073,709,551,615."
|
---|
33 | +
|
---|
34 | class FloatField(TextField):
|
---|
35 | def __init__(self, field_name, max_digits, decimal_places, is_required=False, validator_list=[]):
|
---|
36 | self.max_digits, self.decimal_places = max_digits, decimal_places
|
---|
37 | Index: django_src/django/core/db/backends/postgresql.py
|
---|
38 | ===================================================================
|
---|
39 | --- django_src/django/core/db/backends/postgresql.py (revision 569)
|
---|
40 | +++ django_src/django/core/db/backends/postgresql.py (working copy)
|
---|
41 | @@ -142,6 +142,7 @@
|
---|
42 | # If a column type is set to None, it won't be included in the output.
|
---|
43 | DATA_TYPES = {
|
---|
44 | 'AutoField': 'serial',
|
---|
45 | + 'BigIntegerField': 'bigint',
|
---|
46 | 'BooleanField': 'boolean',
|
---|
47 | 'CharField': 'varchar(%(maxlength)s)',
|
---|
48 | 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
|
---|
49 | @@ -157,6 +158,7 @@
|
---|
50 | 'NullBooleanField': 'boolean',
|
---|
51 | 'OneToOneField': 'integer',
|
---|
52 | 'PhoneNumberField': 'varchar(20)',
|
---|
53 | + 'PositiveBigIntegerField': 'bigint CHECK (%(name)s >= 0)',
|
---|
54 | 'PositiveIntegerField': 'integer CHECK (%(name)s >= 0)',
|
---|
55 | 'PositiveSmallIntegerField': 'smallint CHECK (%(name)s >= 0)',
|
---|
56 | 'SlugField': 'varchar(50)',
|
---|
57 | @@ -171,6 +173,7 @@
|
---|
58 | # Maps type codes to Django Field types.
|
---|
59 | DATA_TYPES_REVERSE = {
|
---|
60 | 16: 'BooleanField',
|
---|
61 | + 20: 'BigIntegerField',
|
---|
62 | 21: 'SmallIntegerField',
|
---|
63 | 23: 'IntegerField',
|
---|
64 | 25: 'TextField',
|
---|
65 | Index: django_src/django/core/db/backends/sqlite3.py
|
---|
66 | ===================================================================
|
---|
67 | --- django_src/django/core/db/backends/sqlite3.py (revision 569)
|
---|
68 | +++ django_src/django/core/db/backends/sqlite3.py (working copy)
|
---|
69 | @@ -144,6 +144,7 @@
|
---|
70 | # schema inspection is more useful.
|
---|
71 | DATA_TYPES = {
|
---|
72 | 'AutoField': 'integer',
|
---|
73 | + 'BigIntegerField': 'bigint',
|
---|
74 | 'BooleanField': 'bool',
|
---|
75 | 'CharField': 'varchar(%(maxlength)s)',
|
---|
76 | 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
|
---|
77 | @@ -159,6 +160,7 @@
|
---|
78 | 'NullBooleanField': 'bool',
|
---|
79 | 'OneToOneField': 'integer',
|
---|
80 | 'PhoneNumberField': 'varchar(20)',
|
---|
81 | + 'PositiveBigIntegerField': 'bigint unsigned',
|
---|
82 | 'PositiveIntegerField': 'integer unsigned',
|
---|
83 | 'PositiveSmallIntegerField': 'smallint unsigned',
|
---|
84 | 'SlugField': 'varchar(50)',
|
---|
85 | Index: django_src/django/core/db/backends/mysql.py
|
---|
86 | ===================================================================
|
---|
87 | --- django_src/django/core/db/backends/mysql.py (revision 569)
|
---|
88 | +++ django_src/django/core/db/backends/mysql.py (working copy)
|
---|
89 | @@ -107,6 +107,7 @@
|
---|
90 | # If a column type is set to None, it won't be included in the output.
|
---|
91 | DATA_TYPES = {
|
---|
92 | 'AutoField': 'mediumint(9) unsigned auto_increment',
|
---|
93 | + 'BigIntegerField': 'bigint',
|
---|
94 | 'BooleanField': 'bool',
|
---|
95 | 'CharField': 'varchar(%(maxlength)s)',
|
---|
96 | 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
|
---|
97 | @@ -122,6 +123,7 @@
|
---|
98 | 'NullBooleanField': 'bool',
|
---|
99 | 'OneToOneField': 'integer',
|
---|
100 | 'PhoneNumberField': 'varchar(20)',
|
---|
101 | + 'PositiveBigIntegerField': 'bigint UNSIGNED',
|
---|
102 | 'PositiveIntegerField': 'integer UNSIGNED',
|
---|
103 | 'PositiveSmallIntegerField': 'smallint UNSIGNED',
|
---|
104 | 'SlugField': 'varchar(50)',
|
---|
105 | @@ -143,7 +145,7 @@
|
---|
106 | FIELD_TYPE.FLOAT: 'FloatField',
|
---|
107 | FIELD_TYPE.INT24: 'IntegerField',
|
---|
108 | FIELD_TYPE.LONG: 'IntegerField',
|
---|
109 | - FIELD_TYPE.LONGLONG: 'IntegerField',
|
---|
110 | + FIELD_TYPE.LONGLONG: 'BigIntegerField',
|
---|
111 | FIELD_TYPE.SHORT: 'IntegerField',
|
---|
112 | FIELD_TYPE.STRING: 'TextField',
|
---|
113 | FIELD_TYPE.TIMESTAMP: 'DateTimeField',
|
---|
114 | Index: django_src/django/core/meta/fields.py
|
---|
115 | ===================================================================
|
---|
116 | --- django_src/django/core/meta/fields.py (revision 569)
|
---|
117 | +++ django_src/django/core/meta/fields.py (working copy)
|
---|
118 | @@ -498,6 +498,14 @@
|
---|
119 | def get_manipulator_field_objs(self):
|
---|
120 | return [formfields.SmallIntegerField]
|
---|
121 |
|
---|
122 | +class BigIntegerField(IntegerField):
|
---|
123 | + def get_manipulator_field_objs(self):
|
---|
124 | + return [formfields.BigIntegerField]
|
---|
125 | +
|
---|
126 | +class PositiveBigIntegerField(IntegerField):
|
---|
127 | + def get_manipulator_field_objs(self):
|
---|
128 | + return [formfields.PositiveBigIntegerField]
|
---|
129 | +
|
---|
130 | class TextField(Field):
|
---|
131 | def get_manipulator_field_objs(self):
|
---|
132 | return [formfields.LargeTextField]
|
---|
133 | Index: django_src/django/views/admin/doc.py
|
---|
134 | ===================================================================
|
---|
135 | --- django_src/django/views/admin/doc.py (revision 569)
|
---|
136 | +++ django_src/django/views/admin/doc.py (working copy)
|
---|
137 | @@ -280,6 +280,7 @@
|
---|
138 | # If a column type is set to None, it won't be included in the output.
|
---|
139 | DATA_TYPE_MAPPING = {
|
---|
140 | 'AutoField' : 'Integer',
|
---|
141 | + 'BigIntegerField' : 'Integer',
|
---|
142 | 'BooleanField' : 'Boolean (Either True or False)',
|
---|
143 | 'CharField' : 'String (up to %(maxlength)s)',
|
---|
144 | 'CommaSeparatedIntegerField': 'Comma-separated integers',
|
---|
145 | @@ -295,6 +296,7 @@
|
---|
146 | 'ManyToManyField' : '',
|
---|
147 | 'NullBooleanField' : 'Boolean (Either True, False or None)',
|
---|
148 | 'PhoneNumberField' : 'Phone number',
|
---|
149 | + 'PositiveBigIntegerField' : 'Integer',
|
---|
150 | 'PositiveIntegerField' : 'Integer',
|
---|
151 | 'PositiveSmallIntegerField' : 'Integer',
|
---|
152 | 'SlugField' : 'String (up to 50)',
|
---|