Upgrade from 1.0.22 to 1.0.23
This guide covers an existing installation of the single Django app
django_chassis on 1.0.22. Keep the project's current AUTH_USER_MODEL. The
migration uses it for the new user relations and leaves existing users in
their current table. A database created with the split-app 1.1.23 layout
requires a separate data migration.
Before deployment
- Pin
django-chassis==1.0.23and update the lock file, keeping the extras the project uses. Package metadata requires Python 3.13 or 3.14 with Django 6.0 or newer, or Python 3.15 with Django 6.1.3 or newer. Verify the resolved Python and Django versions in both the web and worker environments. - Rehearse on a database copy and a private copy of the files referenced by
STORAGES['media']. Record the existing user model, Chassis migrations, and mounted admin site names. Inventory transfer-enabled models and proxies by site, transfer statuses and role grants. - Drain scheduled or queued transfer work under 1.0.22 where possible. Take the web app and workers out of service for the cutover. Save matching backups of the database and transfer files and retain the previous application, lock file and static assets. If messages remain in the broker, record their history IDs and reconcile them before restarting consumers.
- Prepare the transfer permission changes below. Review project overrides
of Chassis templates, routes, and transfer forms. Where the application
runs behind a proxy, set
CHASSIS_TRUSTED_PROXY_NETWORKSto the actual proxy addresses or CIDRs and verify the forwarded client IP. The default empty list usesREMOTE_ADDRand ignoresX-Forwarded-For.
Database changes
Use the project's normal Django entry point and settings.
uv run python manage.py check
uv run python manage.py showmigrations django_chassis --plan
uv run python manage.py migrate --noinput
uv run python manage.py migrate --check
uv run python manage.py collectstatic --noinput
The 1.0.22 migrations 0001 through 0004 stay separate. A new database
applies them first, followed by django_chassis.0005_squashed_0017_platform.
A database at the 1.0.22 migration head applies the combined 1.0.23 migration.
The wheel also ships the original 1.0.23 files and their earlier
0005_platform_updates replacement so Django can continue a partially applied
series from the recorded history.
- The existing user, profile, session, login-attempt and audit data keeps its identity. Profiles gain an optional language, preferred list size, blocking timestamp, soft-delete flag and a phone that must be unique when set. Existing profiles start with an empty phone and no language preference.
- The release adds the language and translation catalog, notifications and
read receipts, account action and impersonation records, and group
membership metadata. Russian (
ru) is seeded as active and primary. English (en) is seeded as inactive. Django's existing group memberships and permission grants are preserved. Chassis records metadata for new group assignments and has no assignment timestamps or actors to backfill for existing memberships. - The existing
chassis_import_historiesandchassis_export_historiestables gainsectionandlanguage_code. Imports also gaincolumn_mapping. Old rows start with empty values for these fields. Files retain their storage paths.
Replace transfer permissions
Both flows require the ModelAdmin's model view permission and their own
view_permission. This lets an operator open the section history and see
operations by other authors in the same section. Import additionally needs
upload_permission to inspect or launch an upload. Export uses
create_permission for launching and download_permission for retrieving
a completed file.
Change each enabled flow from a single permission to distinct operation
codenames. For example, the following settings use a catalog.Book model
with a title field.
# On Book, merge these declarations into the existing Meta.permissions list.
class Meta:
permissions = [
('view_book_import', 'Can view book imports'),
('upload_book_import', 'Can upload book imports'),
('view_book_export', 'Can view book exports'),
('create_book_export', 'Can create book exports'),
('download_book_export', 'Can download book exports'),
]
from django.contrib.admin import ModelAdmin
from django_chassis.mixins import ChassisAdminMixin
from django_chassis.options import ExportOption, ImportOption
class BookAdmin(ChassisAdminMixin, ModelAdmin):
options = [
ImportOption(
fields=['title'],
view_permission='view_book_import',
upload_permission='upload_book_import',
),
ExportOption(
fields=['title'],
view_permission='view_book_export',
create_permission='create_book_export',
download_permission='download_book_export',
),
]
Include a project migration when changing Meta.permissions, or declare the
codenames through the Chassis permission registry. After
migrate creates the permission rows, assign the appropriate grants to the
staff groups. By default, Chassis checks group grants for staff other than
active superusers. A read-only export operator, for example, needs
catalog.view_book and catalog.view_book_export. Give that role
catalog.download_book_export only if it should retrieve finished files.
Legacy permission rows and group assignments stay in the database. The old
permission option argument is still accepted, but a configuration using
only that argument leaves the transfer unavailable. Django checks report an
undeclared code as chassis.E003, a missing operation code as
chassis.E005, and reuse of an operation code across actions or mounted
sections as chassis.E006. Use distinct codes for each mounted site and
model registration, including proxies of the same concrete model.
Every ChassisAdminSiteMixin site automatically registers the translation
catalog with the same five transfer codes in 1.0.23. If you mount several
Chassis sites and want one catalog, unregister TranslationKey on the
secondary sites before using their .urls and rerun check.
from django_chassis.models import TranslationKey
secondary_site.unregister(TranslationKey)
Reconcile legacy transfer history
In 1.0.22, histories used the concrete Django content type even when a
proxy launched the operation. In 1.0.23 a new row stores the pair
AdminSite.name and the exact content type of the registered model.
A legacy row with an empty section resolves automatically only when
one mounted ModelAdmin offers that flow for its concrete model. Count
registrations on all mounted sites, including proxies, separately for
import and export. With zero or multiple candidates, the legacy record is
unavailable in the admin, including its detail and download routes.
For ambiguous rows, use the original site's routes, logs or other records
to establish ownership. Apply the verified site's name and its registered
model's exact content type together in a project data migration or controlled
maintenance script. The following pattern assigns one verified export to a
proxy ModelAdmin and checks that the expected legacy row was updated. Apply
the same procedure to ImportHistory for imports.
from django.contrib.contenttypes.models import ContentType
from django.db import transaction
from catalog.models import Book, BookProxy
from django_chassis.models import ExportHistory
with transaction.atomic():
old_type = ContentType.objects.get_for_model(Book)
owner_type = ContentType.objects.get_for_model(BookProxy, for_concrete_model=False)
updated = ExportHistory.objects.filter(
pk=verified_history_id,
section='',
content_type=old_type,
).update(section=secondary_site.name, content_type=owner_type)
if updated != 1:
raise RuntimeError('Expected one legacy export history row')
Leave unverifiable rows unassigned. Complete this review before granting the new access roles or resuming pending jobs. The worker resolves the current owner and checks its permitted fields, formats and, for exports, journal settings. An undelivered queue message still needs your project's normal recovery procedure. Finished files use their recorded paths, even after the content type changes.
Legacy import records in PREVIEW remain in the database and are hidden
from the admin. Start a fresh upload for any import that was still awaiting
confirmation. The previous source-file download endpoint returns 404.
Protect the source files retained under STORAGES['media'] according to
your storage and retention policy.
Update project integrations
- Import file inspection now returns feedback on the form without creating
a draft history row. Submission launches the job and redirects to its
status page. If you customized the transfer forms, pass the new
operation_idfield and retain the same ID when retrying a submission. See Import and export. - Python callers of
ImportExportDispatchServiceshould usedispatch_import()with the mounted site name, exact registered model, column mapping, language code and operation ID in place ofcreate_import_preview()andconfirm_import(). Passsection=site.nameexplicitly for calls todispatch_export(), particularly for proxy models or multiple sites. For ordinary imports, use an empty language code and an empty mapping when file columns already match their destination fields. - XLSX writes literal text cells for string values. CSV adds an apostrophe to formula-like cell values. Check consumers that compare the raw cell data, especially for CSV, and regenerate older exports when the new behavior is required.
- Use
ImportBackend.WORKERandExportBackend.WORKERin Python. The stored backend value is still3. ImportIMPORT_EXPORT_TASKfromdjango_chassis.worker_tasksand useWorkerService.register_tasks(). Replace forwarding Celery-availability and local-queue services withWorkerService.is_available()andPythonQueueWorkerProvider. See Background tasks. - Replace imports of the removed
EntityPickerwidget with Django's autocomplete widget, or use ChassisEntityPickerOptionto configure the field on a ModelAdmin. See the options catalog. - Configure the built-in footer with
CHASSIS_FOOTER. Use the Chassis sidebar items for Localization, GlobalConfig Settings and Observability. Register the Observability page and detail dialog when adding its link. See Custom pages. - Projects using the GlobalConfig integration can
register the Chassis provider for
chassis.impersonation_frontend_url. Replace any local definition with the provider and reuse the existing category ID. To add extra field names to log redaction, register its provider and enableuse_global_configon the filter. Runinitialize_global_configsafter adding definitions. See Settings and checks. - The built-in Users and Administrators lists are separate. Check custom admin links, templates and group delegation with the roles that use them. Chassis removes a demoted administrator's group memberships. Review projects where the site also uses those memberships for other purposes. See Users.
- Replace any dependency on
chassis_link_first_columnwith a row action. UseRowActionsOption(quick_view=True)when a changelist needs a read-only inspection dialog. See Row and list actions.
Validate and reopen
On the upgraded staging copy, check that migrations are complete and that sample users, group grants, sessions, audit records and transfer files are still present. Sign in with a staff test account and exercise history, upload, export creation and download with the intended rights, including an account with legacy grants only. Confirm that a legacy export opens only on its verified site, that inspection creates no import history row, and that a submitted job reaches a final status. If you use a worker, run a transfer through the real broker and download its finished output. Verify client IP recording through the production proxy topology before reopening traffic.
Record the checksum of the wheel tested on staging. Build or obtain the
1.0.23 artifact that contains 0005_squashed_0017_platform, the original
0016_risk_assessments and 0017_global_alert_journal files, and the
integration modules used by the project. Repeat the checks with that artifact
before deploying it.
Risk observation and the system journal
0016_risk_assessments creates chassis_risk_assessments.
0017_global_alert_journal adds the read-only proxy and its view permission
over GlobalAlert rows. The combined 0005_squashed_0017_platform includes both
operations. Existing alerts and personal read receipts stay in
their original tables.
- Projects enabling risk observation need
Django GlobalConfig 1.1.5 or newer, Celery and django-celery-beat.
Register the provider, initialize GlobalConfig and the schedule, and turn
on
risk.is_enabledonly after verifying the worker and beat. - Staff groups that use the system notification journal
need
django_chassis.view_globalalertjournal. Audit publisher permissions on individual alerts and decide whether to gate the personal inbox separately. - Set up these features in DjangoTemplate on a fresh database or one where assessments and alerts already use the Chassis schema. For a previous installation with project-owned risk and notification tables, use a separate fresh database for this setup. Apply the standard Chassis migrations and grant the Chassis permissions to the intended groups.
Roll back
If cutover fails, pause writes and workers before restoring the pre-upgrade database and corresponding transfer files. Redeploy the 1.0.22 application, dependency lock and static assets. Reconcile outstanding messages against the restored history before restarting consumers and reopening traffic. Plan how to retain or reconcile writes accepted since the backup before restoring it. Restoring the compatible backup also restores the old permission assignments and history ownership. A reverse migration would drop new profile and history fields and tables, including data written by 1.0.23.