lamindb.base.fields.BinaryField¶
- class lamindb.base.fields.BinaryField(*args, **kwargs)¶
Bases:
BinaryField
Custom
BinaryField
with default values forblank
.Django default values for
BinaryField
areblank=False
.Attributes¶
- auto_creation_counter = -46¶
- property choices¶
- class_lookups = {'contains': <class 'django.db.models.lookups.Contains'>, 'endswith': <class 'django.db.models.lookups.EndsWith'>, 'exact': <class 'django.db.models.lookups.Exact'>, 'gt': <class 'django.db.models.lookups.GreaterThan'>, 'gte': <class 'django.db.models.lookups.GreaterThanOrEqual'>, 'icontains': <class 'django.db.models.lookups.IContains'>, 'iendswith': <class 'django.db.models.lookups.IEndsWith'>, 'iexact': <class 'django.db.models.lookups.IExact'>, 'in': <class 'django.db.models.lookups.In'>, 'iregex': <class 'django.db.models.lookups.IRegex'>, 'isnull': <class 'django.db.models.lookups.IsNull'>, 'istartswith': <class 'django.db.models.lookups.IStartsWith'>, 'lt': <class 'django.db.models.lookups.LessThan'>, 'lte': <class 'django.db.models.lookups.LessThanOrEqual'>, 'range': <class 'django.db.models.lookups.Range'>, 'regex': <class 'django.db.models.lookups.Regex'>, 'startswith': <class 'django.db.models.lookups.StartsWith'>}¶
- creation_counter = 950¶
- property db_returning¶
Private API intended only to be used by Django itself.
- property db_tablespace¶
- default_error_messages = {'blank': 'This field cannot be blank.', 'invalid_choice': 'Value %(value)r is not a valid choice.', 'null': 'This field cannot be null.', 'unique': '%(model_name)s with this %(field_label)s already exists.', 'unique_for_date': '%(field_label)s must be unique for %(date_field_label)s %(lookup_type)s.'}¶
- default_validators = []¶
- description = 'Raw binary data'¶
- descriptor_class = <class 'django.db.models.query_utils.DeferredAttribute'>¶
- empty_strings_allowed = True¶
- empty_values = [None, b'']¶
- property flatchoices¶
Flattened version of choices tuple.
- generated = False¶
- get_lookups = functools.partial(<functools._lru_cache_wrapper object>, <class 'lamindb.base.fields.BinaryField'>)¶
- many_to_many = None¶
- many_to_one = None¶
- non_db_attrs = ('blank', 'choices', 'db_column', 'editable', 'error_messages', 'help_text', 'limit_choices_to', 'on_delete', 'related_name', 'related_query_name', 'validators', 'verbose_name')¶
- one_to_many = None¶
- one_to_one = None¶
- register_lookup = functools.partial(<function RegisterLookupMixin.register_class_lookup>, <class 'lamindb.base.fields.BinaryField'>)¶
- system_check_deprecated_details = None¶
- system_check_removed_details = None¶
Class methods¶
- classmethod get_class_lookups()¶
- classmethod register_class_lookup(lookup, lookup_name=None)¶
Methods¶
- check(**kwargs)¶
- deconstruct()¶
- get_internal_type()¶
- get_placeholder(value, compiler, connection)¶
- get_default()¶
- get_db_prep_value(value, connection, prepared=False)¶
- value_to_string(obj)¶
Binary data is serialized as base64
- to_python(value)¶
- get_col(alias, output_field=None)¶
- select_format(compiler, sql, params)¶
Custom format for select clauses. For example, GIS columns need to be selected as AsText(table.col) on MySQL as the table.col data can’t be used by Django.
- clone()¶
Uses deconstruct() to clone a new copy of this Field. Will not preserve any class attachments/attribute names.
- get_pk_value_on_save(instance)¶
Hook to generate new PK values on save. This method is called when saving instances with no primary key value set. If this method returns something else than None, then the returned value is used when saving the new instance.
- run_validators(value)¶
- validate(value, model_instance)¶
Validate value and raise ValidationError if necessary. Subclasses should override this to provide validation logic.
- db_type_parameters(connection)¶
- db_check(connection)¶
Return the database column check constraint for this field, for the provided connection. Works the same way as db_type() for the case that get_internal_type() does not map to a preexisting model field.
- db_type(connection)¶
Return the database column data type for this field, for the provided connection.
- rel_db_type(connection)¶
Return the data type that a related field pointing to this field should use. For example, this method is called by ForeignKey and OneToOneField to determine its data type.
- cast_db_type(connection)¶
Return the data type to use in the Cast() function.
- db_parameters(connection)¶
Extension of db_type(), providing a range of different return values (type, checks). This will look at db_type(), allowing custom model fields to override it.
- db_type_suffix(connection)¶
- get_db_converters(connection)¶
- set_attributes_from_name(name)¶
- contribute_to_class(cls, name, private_only=False)¶
Register the field with the model class it belongs to.
If private_only is True, create a separate instance of this field for every subclass of cls, even if cls is not an abstract model.
- get_filter_kwargs_for_object(obj)¶
Return a dict that when passed as kwargs to self.model.filter(), would yield all instances having the same value for this field as obj has.
- get_attname()¶
- get_attname_column()¶
- pre_save(model_instance, add)¶
Return field’s value just before saving.
- get_prep_value(value)¶
Perform preliminary non-db specific value checks and conversions.
- get_db_prep_save(value, connection)¶
Return field’s value prepared for saving into a database.
- has_default()¶
Return a boolean of whether this field has a default value.
- get_choices(include_blank=True, blank_choice=[('', '---------')], limit_choices_to=None, ordering=())¶
Return choices with a default blank choices included, for use as <select> choices for this field.
- save_form_data(instance, data)¶
- formfield(form_class=None, choices_form_class=None, **kwargs)¶
Return a django.forms.Field instance for this field.
- value_from_object(obj)¶
Return the value of this field in the given model instance.
- slice_expression(expression, start, length)¶
Return a slice of this field.
- get_instance_lookups()¶
- get_lookup(lookup_name)¶
- get_transform(lookup_name)¶
- register_instance_lookup(lookup, lookup_name=None)¶