We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ModelSerializer for different ORMs. Example:
from rest_framework import serializers class ExampleModel(OrmModelClass): field_one = OrmCharFIeld(required=True, field_arg=1) . # etc class ExampleModelSerializer(serializers.Serializer): class Meta: model = ExampleModel fields = ('field_one',) # FROM OBJECT TO JSON obj = ExampleModel(field_one='123') ser = ExampleModelSerializer(instance=obj) print(ser.data) # {"field_one": "Field One"} # FROM JSON TO OBJECT ser = ExampleModelSerializer(data={'field_not_valid_name': None}) ser.is_valid() print(ser.errors) # {'field_one': 'This field is required.'}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Added ModelSerializer for different ORMs.
Example:
The text was updated successfully, but these errors were encountered: