Skip to content

fix: auto-capitalize lead first and last names on save (#703) - #726

Open
aditya226-sharma wants to merge 1 commit into
Kuldeeep18:mainfrom
aditya226-sharma:fix/auto-capitalize-lead-names
Open

fix: auto-capitalize lead first and last names on save (#703)#726
aditya226-sharma wants to merge 1 commit into
Kuldeeep18:mainfrom
aditya226-sharma:fix/auto-capitalize-lead-names

Conversation

@aditya226-sharma

@aditya226-sharma aditya226-sharma commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Auto-capitalizes lead first_name and last_name upon model save so merge tags render as "Hi John" instead of "Hi john".

Changes

  • Added save() override to Lead model that applies .strip().title() to first_name and last_name
  • Handles None/empty values safely
  • Works for both manual creation and CSV imports

Why

When leads are imported or added with lowercase names, personalize merge tags render unprofessionally. This ensures outreach emails always look polished.

Closes #703

Summary by CodeRabbit

  • Bug Fixes
    • Lead first and last names are now automatically trimmed and formatted consistently when saved.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c1511fef-2f37-4fa5-bdfa-8e2aec9940ca

📥 Commits

Reviewing files that changed from the base of the PR and between 4a33158 and 42318ea.

📒 Files selected for processing (1)
  • backend/leads/models.py

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The Lead model now strips whitespace and title-cases populated first and last names before persistence.

Changes

Lead name normalization

Layer / File(s) Summary
Normalize lead names on save
backend/leads/models.py
Lead.save() normalizes non-empty first and last names before delegating to Django’s save operation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 42318

This localized name-formatting change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Suggested reviewers: ramyacm23

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes automatic capitalization of lead names on save.
Linked Issues check ✅ Passed The change meets issue #703 by trimming and title-casing lead first and last names during model saves.
Out of Scope Changes check ✅ Passed The pull request contains only the requested Lead model save behavior and no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LO-116 [Easy]: Auto-Capitalize Lead First and Last Names on Creation

1 participant