Skip to content

Keep max_length when converting TextField to CharField in ModelSerializer #3499

Closed
@tysonzero

Description

@tysonzero

When Django makes a ModelForm out of a Model it validates the max_length of any TextFields (if specified) even though it is not enforced on a database level. I realize this did not use to be the case and that may be why DRF does not currently do the same with ModelSerializers. I see no downside to having them do the same. Currently TextField(max_length=1000) becomes CharField(style={'base_template': 'textarea.html'}).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions