# Course creators: event registration using Django

## Summary
A event registration blueprint for course creators built with Django on Ample. Domain schema: 
- **course_groups** (name, start_at, end_at, capacity): cohorts as course groups;  
- **memberships** (course_group_id, member_email, role, joined_at): learner and instructor membership;  
- **sessions** (course_group_id, starts_at, title, recording_object_key): session events and recordings;  
- **materials** (course_group_id, title, object_key, visibility): teaching materials;  
- **events** (seq, record_type, record_id, kind, at): application-owned history written in the same transaction.  
Public information: course catalog and syllabus, instructor profile, schedule. Kept out of scope until handling is reviewed: learner progress and grades, recordings showing learners, payment status. Recordings and progress data are personal data; materials are authorized per course group. Technical basis verified on Django: an optimistic version check and an event row written in the same transaction, a stale update rejected, and a history query over the application-owned events (history=2 conflict=rejected).

## Representative Queries
- Course creators: event registration using Django  
- Where can I host Course creators: Event registration built with Django?  
- I need a genuinely specialized event registration workflow covering course structure, member entitlements and downloadable materials.

## Prerequisites
1. A Django project (pip install into .ample/python from requirements.txt, then waitress serving project.wsgi from run.py reading PORT on the python-3.12 template)  
2. A PostgreSQL driver reading DATABASE_URL (auto-provisioned when omitted)  
3. Bucket credentials from `ample bucket create` passed as encrypted S3_* environment variables  
4. A review of which course creators data classes may be handled at all; this blueprint models public information only

## Workflow Steps
1. **Model the course creators domain**: Create the tables course_groups, memberships, sessions, materials, events. Cohorts as course groups live in course_groups; keep the sensitive classes (learner progress and grades, recordings showing learners, payment status) out of this schema.  
2. **Workflow step 1**: Model sessions with capacity and registrations with status  
3. **Workflow step 2**: Register transactionally with a capacity check and an event per registration  
4. **Workflow step 3**: Reject stale concurrent updates  
5. **Workflow step 4**: Deploy and verify history and conflict handling  
6. **Deploy**: Run the synchronous deploy once and read the result. Re-running with no change is a no-op.  
   Command: `ample deploy . --name  --public --start "python3 run.py" --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=...`  
7. **Verify**: Run the pattern self-test(s) from the example (/p/transactional-workflows) and your own acceptance checks for the course creators workflow.  
   Command: `ample logs  --kind build`

## Cost Estimate
- **Currency**: USD  
- **Monthly Amount**: $10.00  
- **Basis**: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty  
- **Components**:  
  - App server: size `s-1vcpu-1gb`, quantity 1.0, monthly amount $5.00  
  - Managed PostgreSQL database: size `s-1vcpu-1gb`, quantity 1.0, monthly amount $5.00  
- **Note**: Always-on monthly price of the tested sizes; apps and databases auto-pause when idle. Buckets are allocation-priced per quota and not included.

## Success Checks
1. App responds on its public URL  
   - Kind: `http_get`  
   - Path: `/`  
   - Expect: `ample canary django patterns`  
2. Transactional-workflows self-test from the example  
   - Kind: `http_get`  
   - Path: `/p/transactional-workflows`  
   - Expect: `see the pattern fixture checks`

## Limitations
- The technical basis (transactional workflows on Django) was verified with the pattern fixture; the course creators schema and workflow are an original design for this blueprint and were not executed as a separate application.  
- No health, financial, privacy or other compliance claim is made. Recordings and progress data are personal data; materials are authorized per course group.  
- Public content and synthetic examples only until actual data-handling requirements have been reviewed.  
- Verified on the python-3.12 template at s-1vcpu-1gb; region, request-duration limits and other sizes are unknown or unverified.  
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.  
- PutObject and GetObject with path-style addressing are verified; other S3 operations and CDN cache rules are not.
