A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://django-mysql.readthedocs.io/en/latest/model_fields/tiny_integer_fields.html below:

Tiny integer fields - django-mysql 4.17.0 documentation

Toggle table of contents sidebar

Tiny integer fields

When working with integers that only take small values, Django’s default integer fields can be a bit wasteful as smallest field class, SmallIntegerField, takes 2 bytes. MySQL’s smallest integer data type, TINYINT, is 1 byte, half the size! The below field classes allow you to use the TINYINT and TINYINT UNSIGNED types in Django.

Docs: MySQL TINYINT / MariaDB.

class django_mysql.models.TinyIntegerField(**kwargs)

A subclass of Django’s IntegerField that uses a MySQL TINYINT type for storage. It supports signed integer values ranging from -128 to 127.

Example:

from django.db import models
from myapp.fields import TinyIntegerField


class ExampleModel(models.Model):
    tiny_value = TinyIntegerField()
class django_mysql.models.PositiveTinyIntegerField(**kwargs)

A subclass of Django’s PositiveIntegerField that uses a MySQL TINYINT UNSIGNED type for storage. It supports unsigned integer values ranging from 0 to 255.

Example:

from django.db import models
from myapp.fields import PositiveTinyIntegerField


class ExampleModel(models.Model):
    positive_tiny_value = PositiveTinyIntegerField()

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4