Skip to main content

django-grist-loader

Django reusable app to load data from Grist into read-only Django models.

Installation

The usual way:

  1. Install

    uv add django-grist-loader
    
  2. Configure

    Django's settings:

    INSTALLED_APPS = (
        ...,
        "grist_loader",
        ...,
    )
    
    GRIST_PYGRISTER_CONFIG = {
        "GRIST_API_KEY": os.environ.get("GRIST_API_KEY", ""),
        "GRIST_SELF_MANAGED": "Y",
        "GRIST_SELF_MANAGED_HOME": f"{os.environ.get('GRIST_PROTOCOL', 'https://')}{os.environ.get('GRIST_HOST', '')}",
        "GRIST_SELF_MANAGED_SINGLE_ORG": "N",
        "GRIST_SERVER_PROTOCOL": os.environ.get("GRIST_PROTOCOL", "https://"),
        "GRIST_API_SERVER": os.environ.get("GRIST_HOST", ""),
        "GRIST_API_ROOT": os.environ.get("GRIST_API_ROOT", "api"),
        "GRIST_TEAM_SITE": os.environ.get("GRIST_API_DOCS", "docs"),
        "GRIST_WORKSPACE_ID": os.environ.get("GRIST_WORKSPACE_ID", ""),
        "GRIST_DOC_ID": os.environ.get("GRIST_DOC_ID", ""),
        "GRIST_RAISE_ERROR": "Y",
        "GRIST_SAFEMODE": "N",
    } 
    
  3. Define the required envvars that make sense to your project

Usage

  1. Define a Django model that subclasses GristModel:

    from django.db import models
    from grist_loader.models import GristModel
    
    
    class MyModel(GristModel):
       my_char_field = models.CharField(max_length=100)
       my_int_field = models.IntegerField()
       my_date_field = models.DateField()
    
  2. Within a grist.py module, define a loader class that subclasses GristLoader:

    from django.conf import settings
    from grist_loader.loader import GristLoader, register_grist_loader
    
    from .models import MyModel
    
    
    @register_grist_loader
    class MyLoader(GristLoader):
       model = MyModel
       pygrister_config = settings.GRIST_PYGRISTER_CONFIG
       table = "MyGristTableName"
       required_cols = ("MyChar",)
       fields = {
         "MyChar": MyModel.my_char_field,
         "MyInt": MyModel.my_int_field,
         "MyDate": MyModel.my_date_field,
       }
       filter = {
           "MyChar": ["some value"],
       }
    
  3. Load your data

    python manage.py grist_load_all
    
  4. Profit!

Metadata

Release files for django-grist-loader 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-grist-loader 0.3.0
File Size Uploaded
django_grist_loader-0.3.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-grist-loader 0.3.0
File Interpreter ABI Platform
django_grist_loader-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / django_grist_loader-0.3.0.tar.gz

Download URL django_grist_loader-0.3.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9c7b694c00a6c2128a9e2fd33597b5de063633dfa1f3409403f98f760d8547c2
BLAKE2b-256 checksum
How to use checksums
fc5bf54cf7e7943c1c45298a433b14c479e8f49b8a1588966b54f769f58ca866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.

Transparency log

Release files / django_grist_loader-0.3.0-py3-none-any.whl

Download URL django_grist_loader-0.3.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5892e85181c5f9e84763c92d1e5843d06d425c6046ca6ba30fcbcd4fd9bdfe2d
BLAKE2b-256 checksum
How to use checksums
3cbef4545c9927caf4e223f511c6497e3df8dc487b0519ec1d4742bf986696f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page