makinacorpus / django-geojson

django-geojson is a collection of helpers to (de)serialize (Geo)Django objects into GeoJSON.
GNU Lesser General Public License v3.0
260 stars 69 forks source link

Unable to serialize database: __init__() got an unexpected keyword argument 'use_natural_foreign_keys' #65

Open thecristen opened 8 years ago

thecristen commented 8 years ago

Trying to use the serializer to make use of python manage.py dumpdata --format=geojson find_my_place.County > find_my_place/data/counties.geojson

I have 'djgeojson' in my apps, and i have

SERIALIZATION_MODULES = {
    'geojson' : 'djgeojson.serializers'
}

Django 1.8.7, Python 2.7.10...

leplatrem commented 8 years ago

Thanks for reporting!

Does it work without the --format argument? I mean, with default json format?

dennereed commented 8 years ago

I have the same issue and similar configuration. In settings.py I have

SERIALIZATION_MODULES = {
    'geojson': 'djgeojson.serializers'
}

Django 1.8.4, Python 2.7.6. Omitting the --format argument successfully produces a json file, but QGIS doesn't recognize it even with a geojson extension.

leplatrem commented 8 years ago

Don't hesitate to dig in yourself and submit a fix via a pull-request. I cannot spend time on this :(

Actually I don't use this project anymore, and it looks like makinacorpus is still running Django 1.6

sikmir commented 6 years ago

First of all, Django>=1.8 comes with the built in GeoJSON serializer, so most probably you don't need to use djgeojson at all. What about __init__() got an unexpected keyword argument 'use_natural_foreign_keys' error, the reason is that use_natural_keys option deprecated since Django 1.7 and another new ones introduced: use_natural_foreign_keys and use_natural_primary_keys.