Partial Serializer with GeoFeatureModelSerializer

180 views
Skip to first unread message

stunaz

unread,
Jul 30, 2015, 11:22:18 PM7/30/15
to Django REST Framework GIS
Hello,
Using the GeoFeatureModelSerializer, I not able to get a proper geojson as the example.
Is some one already have this kind of issue?

{
  "id": 9,
  "type": "Feature",
  "geometry": "SRID=4326;POINT (14.4923241138489995 41.8903074341530015)",
  "properties": {
    "address": "Via Laietana, 54, 08003 Barcelona, Barcelona, Spain"
  }
}

Nemesis

unread,
Jul 31, 2015, 5:58:02 AM7/31/15
to django-rest-...@googlegroups.com, stu...@gmail.com
Which DRF-gis version are you using?
--
You received this message because you are subscribed to the Google Groups "Django REST Framework GIS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framew...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stunaz

unread,
Jul 31, 2015, 7:07:37 AM7/31/15
to Django REST Framework GIS, stu...@gmail.com, nem...@ninux.org
I use :
django==1.8.3
djangorestframework==3.1.3
djangorestframework-gis==0.9.3

Here is my model:
class Address(gis_models.Model):
"""Address model"""

address = models.CharField(_('title'), max_length=64, blank=True, null=True)
point = gis_models.PointField(blank=True, null=True)
objects = gis_models.GeoManager()

Here is my serializer:
class AddressSerializer(serializers.GeoFeatureModelSerializer):
"""
Serializing all the addresses
"""

class Meta:
model = Address
fields = ('id', 'address')
geo_field = 'point'

Here is my view:
class AddressDetail(RetrieveUpdateDestroyAPIView):
"""
Retrieve, update or delete an address instance.
"""

queryset = Address.objects.all()
serializer_class = AddressSerializer

On Friday, July 31, 2015 at 5:58:02 AM UTC-4, Federico Capoano wrote:
Which DRF-gis version are you using?




On 07/31/2015 05:22 AM, stunaz wrote:
Hello,
Using the GeoFeatureModelSerializer, I not able to get a proper geojson as the example.
Is some one already have this kind of issue?

{
  "id": 9,
  "type": "Feature",
  "geometry": "SRID=4326;POINT (14.4923241138489995 41.8903074341530015)",
  "properties": {
    "address": "Via Laietana, 54, 08003 Barcelona, Barcelona, Spain"
  }
}
--
You received this message because you are subscribed to the Google Groups "Django REST Framework GIS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework-gis+unsub...@googlegroups.com.

Nemesis

unread,
Jul 31, 2015, 7:54:58 AM7/31/15
to stunaz, Django REST Framework GIS
Is rest_framework_gis in INSTALLED_APPS?

Read here: https://github.com/djangonauts/django-rest-framework-gis#geomodelserializer-deprecated

Although this is probably unintended behaviour.

Let me know.

Federico

stunaz

unread,
Jul 31, 2015, 8:28:33 AM7/31/15
to Django REST Framework GIS, stu...@gmail.com, nem...@ninux.org
Indeed.
I just added it in rest_framework_gis in INSTALLED_APPS, and it solved the problem.
Thanks.

Nemesis

unread,
Jul 31, 2015, 11:30:16 AM7/31/15
to django-rest-...@googlegroups.com
Could you open an issue on github anyway with the summary, please?

This behaviour was not intended, it should have worked anyway, issuing a deprecation warning.

Federico
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framew...@googlegroups.com.

Federico Capoano

unread,
Sep 9, 2015, 5:23:48 AM9/9/15
to Django REST Framework GIS
This should be fixed in 0.9.4.
Reply all
Reply to author
Forward
0 new messages