Skip to main content

A Django app providing a ChunkedTextField for storing large text data in chunks.

Project description

Django Chunked Field

This project provides a custom Django field, ChunkedTextField, designed to handle large text data by splitting it into manageable chunks for storage in a separate database table. Unlike traditional text fields, which may face size limitations in certain database systems, ChunkedTextField bypasses these constraints while seamlessly integrating with Django's ORM. It works transparently with serializers, admin interfaces, and other ORM features, allowing developers to store and retrieve large text data without changing their application logic. The field is particularly useful in applications requiring efficient management of text data exceeding database limits, ensuring scalability and ease of use.

Features

  • Store large text data exceeding database field size limits.
  • Seamlessly integrates with Django's admin and ORM.
  • Customizable truncation for admin display.

Installation

  1. Install the package using pip:

    pip install django-chunked-field
    
  2. Add chunked_field to your INSTALLED_APPS in your Django settings:

    INSTALLED_APPS = [
        ...
        'chunked_field',
    ]
    
  3. Run the migrations to create the necessary database tables:

    python manage.py migrate
    

Usage

Defining a Model

To use the ChunkedTextField, define it in your model as follows:

from django.db import models
from chunked_field.fields import ChunkedTextField


class MyModel(models.Model):
   large_text = ChunkedTextField(truncate_length=100, chunk_size=4000)

Admin Integration

To display the DataChunk model in the Django admin, register it in admin.py:

from django.contrib import admin
from chunked_field.models import DataChunk


@admin.register(DataChunk)
class DataChunkAdmin(admin.ModelAdmin):
   list_display = ('content_type', 'object_id', 'field_name', 'sequence')
   list_filter = ('content_type', 'field_name')
   search_fields = ('content',)

Signal Handlers

The ChunkedTextField automatically handles the chunking and reassembly of data using Django signals. You do not need to manually manage these operations.

License

This project is licensed under the MIT License.


This update includes installation instructions, usage examples, and admin integration details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_chunked_field-0.0.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_chunked_field-0.0.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file django_chunked_field-0.0.1.tar.gz.

File metadata

  • Download URL: django_chunked_field-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.10

File hashes

Hashes for django_chunked_field-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f745ddf93454fb3dd8809c3c984257c47fc4aef6e904d846af5fb6b0a98fc542
MD5 957d4becaa3c1d61a35fa4f13fa758b5
BLAKE2b-256 0e1fb044dd8d15228cb8ac1714a8c652534a2301d62ad94f3e7008c4619e4aef

See more details on using hashes here.

File details

Details for the file django_chunked_field-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_chunked_field-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c376d8a4cda95999ed84e990c189e4d2374f3c532bccd06a7384f506e1f3eab
MD5 8f2b6f32ce3024588a7e3f41063e355e
BLAKE2b-256 7643bb11e4a523c003a9a439288354454fc6c4b131dcf59aec27c24b0c1173c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page