Coder Social home page Coder Social logo

Comments (10)

madisona avatar madisona commented on August 20, 2024

@Chirie - could you post any code that shows more specifically what you are trying? Could this be the same issue as #53

from django-google-maps.

japhethmutai avatar japhethmutai commented on August 20, 2024

Hello @madisona, sorry for taking long to respond to your response. After much digging, I realized that in the django-form-wizard, the form fields ids are named as id_{form_name}-address and id_{form_name}-geolocation. This breaks the google-maps-admin.js file since it is expecting the id in the form of id_address and id_geolocation. I changed this in the .js file to reflect the form field names and it worked. Problem is, now, it breaks other parts that I am using the google maps widget. Is there a way to fix this?

from django-google-maps.

madisona avatar madisona commented on August 20, 2024

hi @japhethmutai I'm not sure of a great way to make the field id a variable you could specify and be able to pass that to an external js file. I'd love to know if you come across a solution for it, as it would be helpful to allow someone to specify the field id's they wanted.

from django-google-maps.

MartinSchere avatar MartinSchere commented on August 20, 2024

Same issue here

from django-google-maps.

iryna-horbachova avatar iryna-horbachova commented on August 20, 2024

Screenshot 2020-10-27 at 21 08 48

Same! Does anyone know what to do with this? The code amlost entirely matches the one in the demo...

from django-google-maps.

madisona avatar madisona commented on August 20, 2024

@iryna-horbachova

The script expects you've named your fields exactly like the example. The stack trace leads me to believe your geocode field may not have an id of id_geolocation.

image

from django-google-maps.

iryna-horbachova avatar iryna-horbachova commented on August 20, 2024

@iryna-horbachova

The script expects you've named your fields exactly like the example. The stack trace leads me to believe your geocode field may not have an id of id_geolocation.

image

Oh, thanks for your reply. So there is no way to have 2 geolocation in the same django model?

from django-google-maps.

madisona avatar madisona commented on August 20, 2024

Hi @iryna-horbachova - that's right, you wouldn't be able to have multiples on the same model without modification.

from django-google-maps.

dmugtasimov avatar dmugtasimov commented on August 20, 2024

Similar happens if geolocation field made read-only (as recommended in the description):

@register(Store)
class StoreAdmin(ModelAdmin):
    list_display = ('name', 'address', 'geolocation')
    readonly_fields = ('geolocation',)
jquery.js:4046 jQuery.Deferred exception: Cannot read property 'value' of null TypeError: Cannot read property 'value' of null
    at Object.getExistingLocation (http://127.0.0.1:8001/static/django_google_maps/js/google-maps-admin.js:105:69)
    at Object.initialize (http://127.0.0.1:8001/static/django_google_maps/js/google-maps-admin.js:41:41)
    at HTMLDocument.<anonymous> (http://127.0.0.1:8001/static/django_google_maps/js/google-maps-admin.js:178:15)
    at mightThrow (http://127.0.0.1:8001/static/admin/js/vendor/jquery/jquery.js:3762:29)
    at process (http://127.0.0.1:8001/static/admin/js/vendor/jquery/jquery.js:3830:12) undefined
jQuery.Deferred.exceptionHook @ jquery.js:4046
jquery.js:4055 Uncaught TypeError: Cannot read property 'value' of null
    at Object.getExistingLocation (google-maps-admin.js:105)
    at Object.initialize (google-maps-admin.js:41)
    at HTMLDocument.<anonymous> (google-maps-admin.js:178)
    at mightThrow (jquery.js:3762)
    at process (jquery.js:3830)

Django 3.1.7

from django-google-maps.

madisona avatar madisona commented on August 20, 2024

@dmugtasimov - the sample app admin.py shows how to make the geolocation field readonly and have it still work appropriately: https://github.com/madisona/django-google-maps/blob/master/sample/admin.py

from django-google-maps.

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.