Re: { "non_field_errors": [ "No data provided" ] } error during a post method.

2020-03-12 Thread Naveen Arora
Hi try debugging it by printing data, where this error is occuring and then 
you will be able to correct it.

Cheers


On Saturday, 11 May 2019 18:05:24 UTC+5:30, Arun Kumar Singamasetty wrote:
>
>
> ##from file serilaizers.py###
>
>
> from rest_framework import serializers
> from .models import Article
>
> # class ArticleSerializer(serializers.Serializer):
> # title = serializers.CharField(max_length=120)
> # description = serializers.CharField()
> # body = serializers.CharField()
> # author_id = serializers.IntegerField()
>
> class ArticleSerializer(serializers.ModelSerializer):
> class Meta:
> model = Article
> fields = ('title', 'description', 'body', 'author_id')
>
> def create(self, validated_data):
> return Article.objects.create(**validated_data)
>
> # class UserSerializer(serializers.HyperlinkedModelSerializer):
>
>
>
>
>
>
> #from file models.py##
>
>
> # from django.db import models
>
> # Create your models here.
> from django.db import models
>
> class Author(models.Model):
>   name = models.CharField(max_length=255)
>   email = models.EmailField()
>
>
> class Article(models.Model):
> title = models.CharField(max_length=120)
> description = models.TextField()
> body = models.TextField()
> author = models.ForeignKey('Author',on_delete=models.CASCADE,)
>
> def __str__(self):
> return self.title
>
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/338e8209-1808-4121-85be-c9fbfe4886bc%40googlegroups.com.


Re: { "non_field_errors": [ "No data provided" ] } error during a post method.

2020-03-11 Thread Julio Evandro
Conseguiu resolver?

Em sábado, 11 de maio de 2019 09:35:24 UTC-3, Arun Kumar Singamasetty 
escreveu:
>
>
> ##from file serilaizers.py###
>
>
> from rest_framework import serializers
> from .models import Article
>
> # class ArticleSerializer(serializers.Serializer):
> # title = serializers.CharField(max_length=120)
> # description = serializers.CharField()
> # body = serializers.CharField()
> # author_id = serializers.IntegerField()
>
> class ArticleSerializer(serializers.ModelSerializer):
> class Meta:
> model = Article
> fields = ('title', 'description', 'body', 'author_id')
>
> def create(self, validated_data):
> return Article.objects.create(**validated_data)
>
> # class UserSerializer(serializers.HyperlinkedModelSerializer):
>
>
>
>
>
>
> #from file models.py##
>
>
> # from django.db import models
>
> # Create your models here.
> from django.db import models
>
> class Author(models.Model):
>   name = models.CharField(max_length=255)
>   email = models.EmailField()
>
>
> class Article(models.Model):
> title = models.CharField(max_length=120)
> description = models.TextField()
> body = models.TextField()
> author = models.ForeignKey('Author',on_delete=models.CASCADE,)
>
> def __str__(self):
> return self.title
>
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/202e20ec-3781-42ff-a3d6-83ebfbce439b%40googlegroups.com.


{ "non_field_errors": [ "No data provided" ] } error during a post method.

2019-05-11 Thread Arun Kumar Singamasetty



##from file serilaizers.py###


from rest_framework import serializers
from .models import Article

# class ArticleSerializer(serializers.Serializer):
# title = serializers.CharField(max_length=120)
# description = serializers.CharField()
# body = serializers.CharField()
# author_id = serializers.IntegerField()

class ArticleSerializer(serializers.ModelSerializer):
class Meta:
model = Article
fields = ('title', 'description', 'body', 'author_id')

def create(self, validated_data):
return Article.objects.create(**validated_data)

# class UserSerializer(serializers.HyperlinkedModelSerializer):






#from file models.py##


# from django.db import models

# Create your models here.
from django.db import models

class Author(models.Model):
  name = models.CharField(max_length=255)
  email = models.EmailField()


class Article(models.Model):
title = models.CharField(max_length=120)
description = models.TextField()
body = models.TextField()
author = models.ForeignKey('Author',on_delete=models.CASCADE,)

def __str__(self):
return self.title


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/424f69bd-4722-4269-914e-de26b978275d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.