--
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 django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/93ceeb6a-c7c1-4c7b-834d-81429ef4b0f8n%40googlegroups.com.
--
--
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 django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/93ceeb6a-c7c1-4c7b-834d-81429ef4b0f8n%40googlegroups.com.
--
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 django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/93ceeb6a-c7c1-4c7b-834d-81429ef4b0f8n%40googlegroups.com.
class Meta:
model = Application
fields = ('id', 'address1', 'address2', 'address3', 'status')
def to_representation(self, instance):
response_dict = dict()
response_dict['id'] = instance.id
response_dict['status'] = instance.status
response_dict['address'] = f"{instance.address1}- {instance.address2} -{instance.address3} - {instance.address4}"
return response_dict
I tired that and it's showing me address still in four rows instead of one row.
You received this message because you are subscribed to a topic in the Google Groups "Django REST framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-rest-framework/B71JQxvpRdE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CA%2BBWBj3eHjtt%2BYSMU8DyKF4SBdZ2i0h3KZME1WR_LFTDcQmQeg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAKcjTSOm-%3DJvk9pOJonTNnOxC8%3Dxp6m-S_R1sJKPhUtdwJeZnw%40mail.gmail.com.
class ListAppsSerializer(serializers.ModelSerializer):
full_address = serializers.SerializerMethodField()
class Meta:
model = Application
fields = ('id', 'full_address', 'status')
def get_full_address(self, obj):
return f"{address1} {address2} {address3} {addres4}"
it's saying address1 address2 address3 and address4 is not defineTo view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAMmJSsGhC_F7s6PQ616ksez5BH%2Bre%3DU3b4FPYzb1aQGJ3k8F1w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAKcjTSMd13pJT1%2BxNo7%2BaNXstMyxFyzZLG6WP4EEHSr4XOefog%40mail.gmail.com.
path('api/filterapplication/<cnic> || <mobile>', ApplicationLIST1.as_view()),def get(self, request, cnic, mobile):
snippets = Application.objects.filter(cnic=cnic) | Application.objects.filter(mobile=mobile)
serializer = ApplicationSerializer(snippets, many=True)
return Response(serializer.data)
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAMmJSsHDYtr3i6a893PjEBEvkbwZVeBUrBurZoATMqjGKfgqRQ%40mail.gmail.com.
Yes Thanks Sir. It's working Now. Thanks again Sir. I have one more questionI want to pass condition base parameters in url how i can do thatpath('api/filterapplication/<cnic> || <mobile>', ApplicationLIST1.as_view()),def get(self, request, cnic, mobile):
snippets = Application.objects.filter(cnic=cnic) | Application.objects.filter(mobile=mobile)
serializer = ApplicationSerializer(snippets, many=True)
return Response(serializer.data)
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAKcjTSOVRXWLcTN65aJRN583t5-X_8XuAi3n-q0JpgvK37xU0w%40mail.gmail.com.