Text & String Fields — Aquilia Documentation
Comprehensive guide and documentation for Text & String Fields in the Aquilia framework. View API reference, examples, and implementation patterns.
Docs / Models / Text Fields Text & String Fields Expressive text fields with bounds validation, email formatting, case-insensitivity checks, and URL patterns. Field Catalogue Field SQL (SQLite / Postgres) Description ))} Case-Insensitive (CI) Fields Aquilia supports first-class case-insensitive lookups via CICharField, CIEmailField, and CITextField. Perfect for user lookups: from aquilia.models.fields_module import CICharField, CIEmailField class User(Model): username = CICharField(max_length=50, unique=True) email = CIEmailField(unique=True) EncryptedField Transparent application-layer encryption at the storage boundary. Plaintext is validated as a normal TextField on assignment; encryption/decryption happens only in to_db()/ to_python() — i.e. only on the wire to/from the database. import os from aquilia.models import Model, EncryptedField # Configure once, at app startup -- before any encrypted field is saved/read. EncryptedField.configure_encryption_key(os.environ["ENCRYPTION_KEY"]) class User(Model): email = CharField(max_length=255, unique=True) ssn = EncryptedField(null=True) user = await User.create(email="a@test.com", ssn="123-45-6789") # The "ssn" column holds ciphertext, not plaintext. reloaded = await User.get(pk=user.pk) reloaded.ssn # "123-45-6789" -- decrypted transparently on read Encryption backend priority: a custom callable pair via configure_encryption(), then Fernet (if the cryptography package is installed) or a stdlib AES-256-GCM fallback via configure_encryption_key(), and — only if nothing was ever configured — a base64 placeholder that provides no confidentiality and emits a loud UserWarning every time it's used. Configure before storing secrets: call configure_encryption_key() or configure_encryption() before any real secret is ever saved. If you see the base64 UserWarning in your logs, nothing is actually encrypted yet. Numeric Fields Date & Time Fields )
Go to Homepage