django-geojson icon indicating copy to clipboard operation
django-geojson copied to clipboard

Problem using serializer with Dumpdata

Open JustinKellogg opened this issue 11 years ago • 2 comments
trafficstars

When I run dumpdata with geojson it doesn't detect any features.

Looked into it a bit and dumpdata passes a generator object to the serialize methods, and this serializer seems to expect queryset-like objects.

JustinKellogg avatar Jun 05 '14 22:06 JustinKellogg

It should work with lists, but indeed, not sure with generators... https://github.com/makinacorpus/django-geojson/blob/master/djgeojson/serializers.py#L346-L347

Instead of isinstance(queryset, list), we could check something like hasattr(queryset, '__iter__'). Don't hesitate to open a pull-request !

leplatrem avatar Jun 06 '14 07:06 leplatrem

Leaving this here as a reference for how dumpdata calls the serializers https://github.com/django/django/blob/master/django/core/management/commands/dumpdata.py#L139 https://github.com/django/django/blob/master/django/core/management/commands/dumpdata.py#L160

JustinKellogg avatar Jun 27 '14 13:06 JustinKellogg