Code Monkey home page Code Monkey logo

Comments (3)

erdem avatar erdem commented on August 17, 2024

I don't have a clear view for this issue but you might need to call {{ location.media }} in HTML <head> tag. Did you compare your view implementation with the demo project views? Check the files link below, if you didn't it.

https://github.com/erdem/django-map-widgets/blob/master/demo/cities/views.py#L20
https://github.com/erdem/django-map-widgets/blob/master/demo/templates/cities/form.html

from django-map-widgets.

Rza-A avatar Rza-A commented on August 17, 2024

Yes, I understand that it could be hard to debug using the limited information provided.

Yes, I placed it both in the header, and also after calling {{ location }}. In both cases, the Django-map-widget was working however the other javascipt codes keep stop working. I think it was because the google widget had to call the Google Api which intrupted the page interpretation.

I was using the provided demo on how to use the widget, however, I didn't include the following code:

<script type="text/javascript">
        $(document).on("google_point_map_widget:marker_create", function (e, lat, lng, locationInputElem, mapWrapID) {
            console.log(locationInputElem); // django widget textarea widget (hidden)
            console.log(lat, lng); // created marker coordinates
            console.log(mapWrapID); // map widget wrapper element ID
        });

        $(document).on("google_point_map_widget:marker_change", function (e, lat, lng, locationInputElem, mapWrapID) {
            console.log(locationInputElem); // django widget textarea widget (hidden)
            console.log(lat, lng);  // changed marker coordinates
            console.log(mapWrapID); // map widget wrapper element ID
        });

        $(document).on("google_point_map_widget:marker_delete", function (e, lat, lng, locationInputElem, mapWrapID) {
            console.log(locationInputElem); // django widget textarea widget (hidden)
            console.log(lat, lng);  // deleted marker coordinates
            console.log(mapWrapID); // map widget wrapper element ID
        })
    </script>

Is the above code compulsory to use?

from django-map-widgets.

erdem avatar erdem commented on August 17, 2024

@Rza-A Nope, those codes are only jquery hook handler examples, You don't need to add them to your HTML template. I have tested the widget the same way you are using and it works for me. If you are still facing the same issue, make sure to call {{ form.media }} in <head> tag.

from django-map-widgets.

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.