Refactoring Guide
M
Written By Melih SünbülLast updated 5 months ago
This is a hands-on, step-by-step guide for migrating a V1 (generic_app) project to the current Lex App framework. Work through it in order — each part builds on the previous one.
If you're starting a new project from scratch, skip this entirely and follow the TeamBudget Tutorial instead.
Before You Start
Make sure you have:
- A working V1 project that you want to migrate
lex-appinstalled (pip install lex-app)- Familiarity with the V1 codebase (model files,
generic_appimports)
Back up your database before starting. Always have a restore point before making sweeping changes to your codebase.
The Series
- Part 1 — Project Structure & Imports — restructure your project into ETL folders and update all imports from
generic_apptolex.* - Part 2 — Models & Fields — convert your model base classes and clean up legacy fields
- Part 3 — Calculations — migrate
ConditionalUpdateMixintoCalculationModel - Part 4 — Lifecycle Hooks — replace
UploadModelMixinwith explicit@hookdecorators - Part 5 — Logging & Permissions — upgrade
CalculationLogtoLexLoggerandModificationRestrictiontopermission_*methods
How Long Does It Take?
Project Size | Estimated Time |
|---|---|
Small (< 10 models) | 1–2 days |
Medium (10–30 models) | 3–5 days |
Large (30+ models) | 1–2 weeks |
Quick Reference
Keep these open while you work:
- V1 to V2 Import Map — complete import replacement table
- Import Migration — systematic import update walkthrough
Was this helpful?
Your feedback shapes what we write next.
