#34308 closed New feature (wontfix)
Create Serializers for models
Reported by: | Hemed Tov | Owned by: | Hemed Tov |
---|---|---|---|
Component: | Core (Serialization) | Version: | dev |
Severity: | Normal | Keywords: | Serializer, Model |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
- Provide CLI to generate corresponding serializers for existing models
- The serializers will be in a seperate module named model_serializers.py, and the serializers module will import from that.
- The default serializer for each model will include as fields all db column names.
- The serializer default name will be the name of the model and serializer
Example:
class Coffee(models.Model): type = models.Charfield(db_column='type') roast_degree = models.IntegerFIeld(db_column='roast_degree) temperature = models.IntegerFIeld(db_column='temperature') class Meta: db_table = 'coffee'
After running the function:
class CoffeeSerializer(serializers.ModelSerializer): class Meta: model = Coffee fields = [ 'type', 'roast_degree', 'temperature', ]
Change History (2)
comment:1 by , 23 months ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Summary: | Feature request: Create Serializers for models → Create Serializers for models |
Note:
See TracTickets
for help on using tickets.
Hi, thanks for the proposition, however I'm not sure what kind of serialization you expect from
ModelSerializer
if it's similar to whatdjango-rest-framework
does then it's a duplicate of #32362. I will treat this report as a request for a new management command. I don't see this as something Django needs to provide andModelSerializer
is not a part of Django.