#34308: Feature request:  Create Serializers for models
-------------------------------------+-------------------------------------
               Reporter:  Hemedbz    |          Owner:  Hemedbz
                   Type:  New        |         Status:  assigned
  feature                            |
              Component:  Core       |        Version:  dev
  (Serialization)                    |
               Severity:  Normal     |       Keywords:  Serializer, Model
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 - 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:

 {{{
 #!python
 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:
 {{{
 #!python
 class CoffeeSerializer(serializers.ModelSerializer):
     class Meta:
           model = Coffee
           fields = [
                    'type',
                    'roast_degree',
                    'temperature',
                     ]

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34308>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018613edbc7a-cc0adfa3-e3f6-4b93-a3d4-a34347d55f4d-000000%40eu-central-1.amazonses.com.

Reply via email to