Giter Club home page Giter Club logo

Comments (8)

kevcooper avatar kevcooper commented on June 27, 2024

@batisteo I received the same error due to having the wrong dependency installed. You want the package "jsonfield" and my guess is you currently have "django-jsonfield". It's confusing since PyPi has both of them named django-jsonfield, but pip uninstall django-jsonfield && pip install jsonfield should fix this

from django-geojson.

leplatrem avatar leplatrem commented on June 27, 2024

I also released django-geojson 1.8.1 with @kevcooper fix about GEOS detection. Let us know :)

from django-geojson.

V1ce avatar V1ce commented on June 27, 2024

Hi,

I actually got the same error.

apps :

Django 1.9.7
python 3.4.2
djgeojson 2.9.0
django-leaflet 0.18.1
django-jsonfield 1.0.0
jsonfield 1.0.3

models.py :

class lieu(models.Model):
    nom = models.CharField(max_length = 100)
    geom = GeometryField()

admin.py :

from plan.models import lieu

admin.site.register(lieu, LeafletGeoAdmin)

traceback :

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/fr/admin/plan/lieu/add/

Django Version: 1.9.7
Python Version: 3.4.2
Installed Applications:
['djangocms_admin_style',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.admin',
 'django.contrib.sites',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'cms',
 'menus',
 'sekizai',
 'treebeard',
 'djangocms_text_ckeditor',
 'djangocms_style',
 'djangocms_column',
 'filer',
 'easy_thumbnails',
 'cmsplugin_filer_image',
 'cmsplugin_filer_file',
 'cmsplugin_filer_folder',
 'cmsplugin_filer_teaser',
 'cmsplugin_filer_utils',
 'cmsplugin_filer_video',
 'djangocms_googlemap',
 'djangocms_inherit',
 'djangocms_link',
 'reversion',
 'bgl',
 'ckeditor',
 'recurrence',
 'haystack',
 'aldryn_common',
 'aldryn_boilerplates',
 'aldryn_video',
 'aldryn_search',
 'aldryn_bootstrap3',
 'standard_form',
 'debug_toolbar',
 'spurl',
 'leaflet',
 'djgeojson',
 'adminsortable2',
 'gunicorn',
 'nocaptcha_recaptcha',
'plan']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
 'cms.middleware.utils.ApphookReloadMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware',
 'cms.middleware.language.LanguageCookieMiddleware']



Traceback:

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/contrib/admin/options.py" in wrapper
  541.                 return self.admin_site.admin_view(view)(*args, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/contrib/admin/sites.py" in inner
  244.             return view(request, *args, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/contrib/admin/options.py" in add_view
  1437.         return self.changeform_view(request, None, form_url, extra_context)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/utils/decorators.py" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/usr/lib/python3.4/contextlib.py" in inner
  30.                 return func(*args, **kwds)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/contrib/admin/options.py" in changeform_view
  1367.         ModelForm = self.get_form(request, obj)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/contrib/admin/options.py" in get_form
  639.             return modelform_factory(self.model, **defaults)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/forms/models.py" in modelform_factory
  545.     return type(form)(class_name, (form,), form_class_attrs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/forms/models.py" in __new__
  247.                                       opts.field_classes)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/forms/models.py" in fields_for_model
  176.             formfield = formfield_callback(f, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/leaflet/admin.py" in formfield_for_dbfield
  42.             return db_field.formfield(**kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/djgeojson/fields.py" in formfield
  65.         return super(GeoJSONField, self).formfield(**kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/jsonfield/fields.py" in formfield
  46.         return super(JSONField, self).formfield(**defaults)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/db/models/fields/__init__.py" in formfield
  903.         return form_class(**defaults)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/jsonfield/forms.py" in __init__
  15.         super(JSONFormField, self).__init__(*args, **kwargs)

File "/home/vincent/venv/cms/lib/python3.4/site-packages/django/forms/fields.py" in __init__
  229.         super(CharField, self).__init__(*args, **kwargs)

Exception Type: TypeError at /fr/admin/plan/lieu/add/
Exception Value: __init__() got an unexpected keyword argument 'geom_type'

I got this after upgrade django to 1.9 from 1.8, django-leaflet to 0.18 from 0.17 and django-geojson 2.9.0 from 2.8.1

I try the @kevcooper manipulation on django-jsonfield but no success because "jsonfield" don't contain a forms module, django-geojson need both apps for work.

Like you see i use django-cms but i think it is not the problem, thats work with it before the upgrade.

Thanks

from django-geojson.

V1ce avatar V1ce commented on June 27, 2024

Fixed this with downgrade django from 1.9.7 to 1.8.13 , jsonfield 1.0.3 to 1.0.0 and django-geojson 2.9.0 to 2.8.1 and this work, and then re-upgrade all to latest and work too.... Don't understand.

from django-geojson.

stitch avatar stitch commented on June 27, 2024

Same issue here... can't fix it by installing the other package... still need to trace the issue. Keep u posted.

from django-geojson.

stitch avatar stitch commented on June 27, 2024

After reading http://fle.github.io/easy-webmapping-with-django-leaflet-and-django-geojson.html i assumed(!) that just adding django-geojson and django-leaflet to the requirements / installing them with pip is enough.

What i forgot is to install them properly. After reading through the manuals:
1: https://django-geojson.readthedocs.io/en/latest/installation.html
2: https://django-leaflet.readthedocs.io/en/latest/installation.html

It's mentioned that you must add them to INSTALLED_APPS too, and you indeed need jsonfield, not django-jsonfield. Obvious :)

After that's done it works like a charm.

(Do note that these fields do not store raw geojson: they store their own structure which may not be compatible with the data you're processing now. However: that leads to different errors and different challenges :))

from django-geojson.

batisteo avatar batisteo commented on June 27, 2024

I’m not using it anymore, so I can't test the original issue. You can close it at will.

from django-geojson.

leplatrem avatar leplatrem commented on June 27, 2024

It would be nice to propose a fix on the documentation to make it «obvious»

from django-geojson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.