Management commands

Midsummer ships a number of Django management commands under */management/commands/. This page documents what each one actually does, because several carry stale placeholder help strings (commonly the leftover "Trims duplicate entries from Stripe to Registrant Datas").

Naming convention

  • Newer commands use the <app>__<verb> (double-underscore) form so they group by app in manage.py help (e.g. register__export_reg_timeline).

  • Older commands use a plain name (init_seed_data, customdomain_*).

Tenant context matters. Commands that touch tenant data run against one tenant’s schema. Use all_tenants_command <cmd> to run a command across every tenant schema. Commands that read connection.schema_name must run from inside the owning tenant’s context.

tenant

Note

init_new_tenant and init_seed_data both report "Initializes Midsummer with Seed Data for Testing" as their help, but they are not test-only — see the descriptions.

Command

What it does

init_seed_data

Local bootstrap. Creates a default tenant (defaultdev), a default event, and a superuser (you choose email/password), and optionally prompts for a Stripe key. Run after migrate_schemas --shared.

init_new_tenant

Onboard a real tenant (run in production with MIDSUMMER_PROD=true). Prompts for tenant name + subdomain, creates the Tenant + primary Domain, an event, and either reuses or creates an admin user (sends a password reset if new). See Add a new tenant.

tenant__create_domain

Create a domain on an existing tenant.

tenant__gen_memberids

Generate member IDs.

customdomain_issue

Issue/retry Let’s Encrypt certificates for custom domains. Flags: --domain <host>, --all (all dns_verified+failed), --force (re-issue even if ssl_issued).

customdomain_renew

Renew LE certificates for all custom domains and regenerate the nginx config.

customdomain_regen_nginx

Regenerate the nginx custom-domains.conf from the database (no cert work). See Custom domains.

event

Command

What it does

event__generate_properties

Seed the comprehensive default EventProperty rows (register/vendors/staff/schedule settings) for every event. Run as all_tenants_command event__generate_properties.

event__add_stripe_key

Interactively prompt for a Stripe API key and associate it with the first event (creates a djstripe.APIKey + utility.StripeKey).

event__assign_default_domain

Set each event’s subdomain to its tenant’s first Domain.

register

Warning

Several register commands are operational reconciliation / one-off scripts that hit the live Stripe API. They iterate over Event.objects.all() and mutate is_paid / sent_email flags. Read the code before running in production, and prefer --dry-run-style preview where the command supports it.

Command

What it does

register__export_reg_timeline

Maintained, documented. Export an event’s registration timeline to the year-over-year chart JSON consumed by register-metrics2. Args: --event <slug> (required), --year, --output-dir, --paid-only, --rebuild-combined. Writes per-event under <dir>/<schema>/<event_slug>/. See Update registration metrics.

register__check_unfinished

Reconcile: registrations marked unpaid that are actually paid in Stripe → mark is_paid=True. Iterates all events.

register__check_unfinished_cron

Cron-friendly variant of check_unfinished.

register__checkpaid

Diagnostic (read-mostly): counts registrations marked paid that are confirmed paid in Stripe (verifies checkout session → payment intent → charge/refund). Prints per-reg detail.

register__oops

Reconcile “sent a confirmation but not actually paid”: for paid+emailed regs updated in the last 24h that Stripe says are unpaid → mark is_paid=False, sent_email=False, and send a “disregard previous email” message. Operational one-off with a hardcoded from-domain.

register__send_email

Send registration confirmation emails (via the RegisterSendEmail trigger) for registrations of a given event that haven’t been emailed. Arg: the event pk.

register__check_resend

Re-send confirmation emails (regenerates the QR code) for paid, unsent registrations.

register__merch_summary

Event-specific one-off: builds a merchandise summary. Contains hardcoded RegistrationLevel UUIDs — clone/parameterize before reuse. The canonical option-rendering logic in it (get_option_display/get_option_key) is the reference implementation other code mirrors.

register__manual_export

Event-specific one-off: CSV export with hardcoded tier UUIDs.

register__syncv1

Migration utility: pull registrations from a legacy “v1” system over HTTP and map them (incl. a merch-name mapping table). One-off.

register__test_emails / register__test_qrcode / register__test_multilayer_return

Test utilities for email rendering and QR/multilayer return. One-off/test scaffolding.

schedule

Command

What it does

schedule__import_xlsx

Import panels and times from an XLSX file.

shop

Command

What it does

shop__export_addon_selections

Export shop order addon selections + form data to an Excel spreadsheet. Args: --event, --output, --paid-only.

shop__send_fulfillment_emails

Send fulfillment emails for paid shop orders not yet emailed. Args: --event, --dry-run (preview), --resend (re-send already-sent).

shop__rerun_fulfillment_stripecheck

Re-run the fulfillment Stripe-payment check across orders.

staff

Command

What it does

staff__check_permissions

Diagnostic: print the resolved permissions for a user. Args: --email, --event (omit = all events in the tenant), --hr (simulate an HR action check — excludes deputies/staff/volunteers from leadership-level perms).

staff__check_menu

Diagnostic: simulate which menu items a user would see. Args: --email, --event, --app (limit to one app).

misc

Command

What it does

misc__populate_zipcodes

Initialize ZIP codes from a CSV file.

Adding a new command

  1. Create <app>/management/__init__.py and <app>/management/commands/__init__.py if missing.

  2. Add <app>/management/commands/<app>__<verb>.py with a Command(BaseCommand).

  3. Write an accurate help string (don’t copy the stale placeholder).

  4. If it touches tenant data, make it schema-aware and document the tenant- context requirement. Prefer all_tenants_command-friendliness where sensible.