Skip to content

max_length validation is not wroking with Modelserializer  #9485

@Anshulgoplus

Description

@Anshulgoplus

I created a model have a field as charField and has max_length then i created a model serailzer for that model by the serializer is not validating the field with max_length

class MyModel(models.Model):
name = models.CharField(max_length=255, verbose_name=_("Name"))

class MyModelSerializer(ModelSerializer):
classs Meta:
model=MyModel
fields = "all"

when I send a post request with name as 256 chars it is throwing 500 it should throw 400

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions