Top "Django-serializer" questions

Django provides serializers for serializing models into common data formats such as JSON and XML.

Django rest framework serializing many to many field

How do I serialize a many-to-many field into list of something, and return them through rest framework? In my example …

python django django-models django-rest-framework django-serializer
How to serialize Django queryset.values() into json?

I have a model that has many fields, however for this problem I only need 3 of those fields. When I …

python json django django-models django-serializer
Django REST framework serializer without a model

I'm working on a couple endpoints which aggregate data. One of the endpoints will for example return an array of …

django django-rest-framework django-serializer
Editing django-rest-framework serializer object before save

I want to edit a django-rest-framwork serializer object before it is saved. This is how I currently do it - …

python django serialization django-rest-framework django-serializer
Create JSON Response in Django with Model

I am having some issue here. I am trying to return a JSON response made of a message and a …

python django json django-models django-serializer
'dict' object has no attribute '_meta' on Django Serializer

def display_home(request): from datetime import * now=datetime.today() print 'Month is %s'%now.month events=Event.objects.filter(…

json django django-queryset django-serializer
Dynamically exclude or include a field in Django REST framework serializer

I have a serializer in Django REST framework defined as follows: class QuestionSerializer(serializers.Serializer): id = serializers.CharField() question_text = …

python django serialization django-rest-framework django-serializer
AssertionError: `HyperlinkedIdentityField` requires the request in the serializer context

I want to create a many-to-many relationship where one person can be in many clubs and one club can have …

python django django-views django-rest-framework django-serializer
Change a field in a Django REST Framework ModelSerializer based on the request type?

Consider this case where I have a Book and Author model. serializers.py class AuthorSerializer(serializers.ModelSerializer): class Meta: model = …

django django-rest-framework django-serializer
How to call serializer's create() method from one serializer

I have two serializers, "UserSerializer" and "CustomerSerializer" as bellow class UserSerializer(serializers.ModelSerializer): def create(self, validated_data): return User.…

django django-models django-rest-framework django-serializer