# Quick Deploy - Branch & Portfolio Filtering

## 🚀 One-Command Deployment

### For Production (Safe with Backups):

```bash
python deploy_filtering_to_production.py
```

This will:
- ✓ Create automatic backups
- ✓ Verify everything is ready
- ✓ Apply the filtering updates
- ✓ Run verification tests
- ✓ Give you rollback instructions

---

## ⚡ What Happens:

1. **Backup** - Automatically backs up all files
2. **Verify** - Checks prerequisites and Django setup
3. **Test** - Tests filtering with your real data
4. **Apply** - Updates view files with filtering
5. **Verify** - Runs comprehensive tests
6. **Restart** - Tells you how to restart your app

---

## 🔄 If Something Goes Wrong:

The script will give you a rollback command like:
```bash
python deploy_filtering_to_production.py --rollback backup_before_filtering_20251128_153000
```

---

## ✅ After Deployment:

1. **Restart your application** (script will tell you how)
2. **Test with different users:**
   - Login as admin - should see all data
   - Login as loan officer - should see only portfolio
   - Login as secretary - should see only branch

3. **Verify filtering works:**
   ```bash
   python verify_filtering_implementation.py
   ```

---

## 📋 Quick Checklist:

Before running:
- [ ] Have database backup
- [ ] Know how to restart your app
- [ ] Have 5 minutes for deployment

After running:
- [ ] Restart application
- [ ] Test with different user roles
- [ ] Verify dashboard shows correct data

---

## 🆘 Need Help?

- **Full Guide**: Read `PRODUCTION_DEPLOYMENT_FILTERING.md`
- **User Guide**: Read `STAFF_FILTERING_GUIDE.md`
- **Technical Docs**: Read `COMPREHENSIVE_FILTERING_IMPLEMENTATION.md`

---

## 🎯 That's It!

Just run the command and follow the prompts. The script handles everything safely with automatic backups.

**Ready? Let's go! 🚀**

```bash
python deploy_filtering_to_production.py
```
