1234567891011121314151617181920212223242526272829 |
- from sqlmodel_serializers import SQLModelSerializer
- from .models import Hero
- class HeroUpdate(SQLModelSerializer):
- class Meta:
- model = Hero
- optional = '__all__'
- fields = ('name', 'secret_name', 'age')
- class HeroRead(SQLModelSerializer):
- id: int
- full_name: str
- class Meta:
- model = Hero
- class HeroCreate(SQLModelSerializer):
- class Meta:
- model = Hero
- fields = ('name', 'secret_name', 'age')
|