*My data is*
{
"id": 1,
"title": "",
"href": "https://www.douban.com/";,
"abstract": "{'a':1,'b':2}",
"img": "",
"favs": 0
}

*I want to*

{
"id": 1,
"title": "",
"href": "https://www.douban.com/";,
"abstract": {'a':1,'b':2},
"img": "",
"favs": 0
}
*What should I do?*

*I am a rookie...*

*models.py*

from django.db import models

class doulist(models.Model):

    title = models.CharField(max_length=200,blank=True)
    href = models.CharField(max_length=200,unique=True)
    abstract = models.TextField(blank=True)
    img = models.CharField(max_length=150,blank=True)
    favs = models.IntegerField(default=0)
    update = models.DateField(auto_now=True)
    types = models.CharField(max_length=20)


serializers.py


from rest_framework import serializers
from .models import doulist
class SnippetSerializer(serializers.ModelSerializer):
    class Meta:
        model = doulist
        fields = ('id','title', 'href', 'abstract', 'img', 'favs')



-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to