Ticket #399: bigint_patch_06aug06.txt

File bigint_patch_06aug06.txt, 4.5 KB (added by Gopal Narayanan <gopastro@…>, 18 years ago)
Line 
1Index: django/db/models/fields/__init__.py
2===================================================================
3--- django/db/models/fields/__init__.py (revision 3608)
4+++ django/db/models/fields/__init__.py (working copy)
5@@ -663,6 +663,14 @@
6 def get_manipulator_field_objs(self):
7 return [forms.IntegerField]
8
9+class BigIntegerField(IntegerField):
10+ def get_manipulator_field_objs(self):
11+ return [forms.BigIntegerField]
12+
13+class PositiveBigIntegerField(IntegerField):
14+ def get_manipulator_field_objs(self):
15+ return [forms.PositiveBigIntegerField]
16+
17 class IPAddressField(Field):
18 def __init__(self, *args, **kwargs):
19 kwargs['maxlength'] = 15
20Index: django/db/backends/mysql/introspection.py
21===================================================================
22--- django/db/backends/mysql/introspection.py (revision 3608)
23+++ django/db/backends/mysql/introspection.py (working copy)
24@@ -82,7 +82,7 @@
25 FIELD_TYPE.FLOAT: 'FloatField',
26 FIELD_TYPE.INT24: 'IntegerField',
27 FIELD_TYPE.LONG: 'IntegerField',
28- FIELD_TYPE.LONGLONG: 'IntegerField',
29+ FIELD_TYPE.LONGLONG: 'BigIntegerField',
30 FIELD_TYPE.SHORT: 'IntegerField',
31 FIELD_TYPE.STRING: 'TextField',
32 FIELD_TYPE.TIMESTAMP: 'DateTimeField',
33Index: django/db/backends/mysql/creation.py
34===================================================================
35--- django/db/backends/mysql/creation.py (revision 3608)
36+++ django/db/backends/mysql/creation.py (working copy)
37@@ -14,12 +14,14 @@
38 'FloatField': 'numeric(%(max_digits)s, %(decimal_places)s)',
39 'ImageField': 'varchar(100)',
40 'IntegerField': 'integer',
41+ 'BigIntegerField': 'bigint',
42 'IPAddressField': 'char(15)',
43 'ManyToManyField': None,
44 'NullBooleanField': 'bool',
45 'OneToOneField': 'integer',
46 'PhoneNumberField': 'varchar(20)',
47 'PositiveIntegerField': 'integer UNSIGNED',
48+ 'PositiveBigIntegerField': 'bigint UNSIGNED',
49 'PositiveSmallIntegerField': 'smallint UNSIGNED',
50 'SlugField': 'varchar(%(maxlength)s)',
51 'SmallIntegerField': 'smallint',
52Index: django/forms/__init__.py
53===================================================================
54--- django/forms/__init__.py (revision 3608)
55+++ django/forms/__init__.py (working copy)
56@@ -738,6 +738,20 @@
57 if not 0 <= int(field_data) <= 32767:
58 raise validators.CriticalValidationError, gettext("Enter a whole number between 0 and 32,767.")
59
60+class BigIntegerField(IntegerField):
61+ def __init__(self, field_name, length=20, maxlength=None, is_required=False, validator_list=None, member_name=None):
62+ if validator_list is None: validator_list = []
63+ validator_list = [self.isInteger] + validator_list
64+ if member_name is not None:
65+ self.member_name = member_name
66+ IntegerField.__init__(self, field_name, length, maxlength, is_required, validator_list)
67+
68+class PositiveBigIntegerField(PositiveIntegerField):
69+ def __init__(self, field_name, length=20, maxlength=None, is_required=False, validator_list=None):
70+ if validator_list is None: validator_list = []
71+ validator_list = [self.isPositive] + validator_list
72+ IntegerField.__init__(self, field_name, length, maxlength, is_required, validator_list)
73+
74 class FloatField(TextField):
75 def __init__(self, field_name, max_digits, decimal_places, is_required=False, validator_list=None):
76 if validator_list is None: validator_list = []
77Index: django/contrib/admin/views/doc.py
78===================================================================
79--- django/contrib/admin/views/doc.py (revision 3608)
80+++ django/contrib/admin/views/doc.py (working copy)
81@@ -289,6 +289,7 @@
82 # If a column type is set to None, it won't be included in the output.
83 DATA_TYPE_MAPPING = {
84 'AutoField' : _('Integer'),
85+ 'BigIntegerField' : _('Integer'),
86 'BooleanField' : _('Boolean (Either True or False)'),
87 'CharField' : _('String (up to %(maxlength)s)'),
88 'CommaSeparatedIntegerField': _('Comma-separated integers'),
89@@ -306,6 +307,7 @@
90 'NullBooleanField' : _('Boolean (Either True, False or None)'),
91 'OneToOneField' : _('Relation to parent model'),
92 'PhoneNumberField' : _('Phone number'),
93+ 'PositiveBigIntegerField' : _('Integer'),
94 'PositiveIntegerField' : _('Integer'),
95 'PositiveSmallIntegerField' : _('Integer'),
96 'SlugField' : _('String (up to %(maxlength)s)'),
Back to Top