Skip to content

Fixed #36813 -- Made CharField.max_length and DecimalField's - #21671

Closed
Prachi-Gupta2808 wants to merge 1 commit into
django:mainfrom
Prachi-Gupta2808:ticket_36813
Closed

Fixed #36813 -- Made CharField.max_length and DecimalField's#21671
Prachi-Gupta2808 wants to merge 1 commit into
django:mainfrom
Prachi-Gupta2808:ticket_36813

Conversation

@Prachi-Gupta2808

@Prachi-Gupta2808 Prachi-Gupta2808 commented Jul 26, 2026

Copy link
Copy Markdown

Trac ticket number

ticket-36813

Branch description

Moves CharField.max_length and DecimalField.max_digits/decimal_places
validation from system checks into init(), raising ValueError
immediately for invalid values instead of only via manage.py check.

AI Assistance Disclosure (REQUIRED)

  • No AI tools were used in preparing this PR.
  • If AI tools were used, I have disclosed which ones, and fully reviewed and verified their output.

Claude for verification of work after I wrote the code myself and ran all tests to make sure if I did not make any wrong changes.

Checklist

  • This PR follows the contribution guidelines.
  • This PR does not disclose a security vulnerability (see vulnerability reporting).
  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number (if applicable), and ends with a period (see guidelines).
  • I have not requested, and will not request, an automated AI review for this PR.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

max_digits/decimal_places validation happen at initialization.

Moved simple, static validation (positive integer, non-negative
integer checks) from the system check framework into __init__(),
so invalid values raise ValueError immediately -- including for
fields not attached to a model (e.g. as an output_field for Cast()).

Thanks Jacob Walls for the report, and Mehraz Hossain Rumman for the
initial patch in PR django#20439.
@github-actions github-actions Bot closed this Jul 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

@github-actions

Copy link
Copy Markdown

Thank you for your contribution to Django! This pull request has one or more items that need attention before it can be accepted for review.

⚠️ Warning: Incorrect Trac Ticket Flag

The referenced ticket ticket-36813 does not have the Has patch flag set in Trac. This flag must be checked before a pull request can be reviewed.

What to do:

  1. Open the ticket at https://code.djangoproject.com/ticket/36813.
  2. Scroll down and check the Has patch checkbox on the ticket.
  3. Save the ticket.

For more information see https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#has-patch.

If you have questions about these requirements, please review the contributing guidelines or ask for help on the Django Forum.

@Prachi-Gupta2808

Copy link
Copy Markdown
Author

@github-actions please re-check

I have updated the Trac ticket (#36813) and set the "Has patch" flag as required.

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.

1 participant