On Tuesday, February 19, 2019 at 10:02:32 PM UTC+5:30, [email protected] 
wrote:
>
> Hi I have data like this 
> { 
> "Name" : "pk", 
> "Applist" : ["zom","bc"], 
>  "Url":   ["As","de"] 
>
> } 
>
> How to define field name for list I am not getting


i define a class with foreign key but still getting error?

class keywordfield(models.Model):
    keyword=models.CharField(max_length=50,null=True)
    appNamefield=models.ForeignKey("appNamefield", on_delete=models.CASCADE)






class appNamefield(models.Model):
    appName = models.CharField(max_length=50,null=True)


serializer class
class appDetailsSearilizer(serializers.ModelSerializer):
    class Meta:
        model = keywordfield


        fields = ('id','keyword','appNamefield')

json data

{
  
        "keyword": "food",
  "appNamefield":["j","l"]
        
  
}


error
dict_items([('required', 'This field is required.'), ('null', 'This field may 
not be null.'), ('invalid', 'Invalid data. Expected a dictionary, but got 
{datatype}.')])

 




 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/914062e6-1475-4653-8010-58a43b5bacb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to