Ticket #2417: binaryfield.patch
File binaryfield.patch, 4.1 KB (added by , 18 years ago) |
---|
-
django/db/models/manipulators.py
278 278 if isinstance(field_list[0].rel, ManyToOneRel): 279 279 kwargs = {'%s__%s__iexact' % (field_name_list[0], field_list[0].rel.field_name): field_data} 280 280 else: 281 kwargs = {'%s__ iexact' % field_name_list[0]: field_data}281 kwargs = {'%s__exact' % field_name_list[0]: field_data} 282 282 for f in field_list[1:]: 283 283 # This is really not going to work for fields that have different 284 284 # form fields, e.g. DateTime. … … 291 291 if isinstance(f.rel, ManyToOneRel): 292 292 kwargs['%s__pk' % f.name] = field_val 293 293 else: 294 kwargs['%s__ iexact' % f.name] = field_val294 kwargs['%s__exact' % f.name] = field_val 295 295 try: 296 296 old_obj = self.manager.get(**kwargs) 297 297 except ObjectDoesNotExist: -
django/db/models/fields/__init__.py
385 385 raise validators.ValidationError, gettext_lazy("This field cannot be null.") 386 386 return str(value) 387 387 388 class BinaryField(CharField): 389 """Sometimes we have fields that need to store a small amount of binary 390 data. This is different then a varchar on postgresql at least because it 391 will not allow fields that are just nul bytes. 392 """ 393 def get_manipulator_field_objs(self): 394 # XXX We should probably use a better form field for this. Like 395 # XXX something that can grok colon-separated hexlify. 396 # 397 return [django.forms.TextField] 398 399 388 400 # TODO: Maybe move this into contrib, because it's specialized. 389 401 class CommaSeparatedIntegerField(CharField): 390 402 def get_manipulator_field_objs(self): -
django/db/backends/ado_mssql/creation.py
1 1 DATA_TYPES = { 2 2 'AutoField': 'int IDENTITY (1, 1)', 3 'BinaryField': 'varbinary(%(maxlength)s)', 3 4 'BooleanField': 'bit', 4 5 'CharField': 'varchar(%(maxlength)s)', 5 6 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', -
django/db/backends/postgresql/creation.py
4 4 # If a column type is set to None, it won't be included in the output. 5 5 DATA_TYPES = { 6 6 'AutoField': 'serial', 7 'BinaryField': 'bytea', 7 8 'BooleanField': 'boolean', 8 9 'CharField': 'varchar(%(maxlength)s)', 9 10 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', -
django/db/backends/sqlite3/creation.py
3 3 # schema inspection is more useful. 4 4 DATA_TYPES = { 5 5 'AutoField': 'integer', 6 'BinaryField': 'BLOB', 6 7 'BooleanField': 'bool', 7 8 'CharField': 'varchar(%(maxlength)s)', 8 9 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', -
django/db/backends/mysql/creation.py
4 4 # If a column type is set to None, it won't be included in the output. 5 5 DATA_TYPES = { 6 6 'AutoField': 'integer AUTO_INCREMENT', 7 'BinaryField': 'varbinary(%(maxlength)s)', 7 8 'BooleanField': 'bool', 8 9 'CharField': 'varchar(%(maxlength)s)', 9 10 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',