Skip to main content

Google Maps widget for django-fluent-contents

Project description

fluentcms-googlemaps

A plugin for django-fluent-contents to show a Google Maps widget on a website.

This plugin is a work in progress. It’s already used in production, just know that there are two main area’s that need improval:

  • Use a better GeoPosition widget (e.g. by using a lightbox/popup)

  • Make cluster icons configurable.

Installation

First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install fluentcms-googlemaps

Backend Configuration

First make sure the project is configured for django-fluent-contents.

Then add the following settings:

INSTALLED_APPS += (
    'fluentcms_googlemaps',
)

Add the following to urls.py:

urlpatterns = [
    ...

    url(r'^api/googlemaps/', include('fluentcms_googlemaps.urls')),
]

The database tables can be created afterwards:

./manage.py migrate

Now, the MapPlugin can be added to your PlaceholderField and PlaceholderEditorAdmin admin screens.

Frontend Configuration

Make sure that all plugin media files are exposed by django-fluent-contents:

{% load frontend_contents_tags %}

{% render_content_items_media %}

This tag should be placed at the bottom of the page, after all plugins are rendered. For more configuration options - e.g. integration with django-compressor - see the template tag documentation.

CSS Code

The stylesheet code is purposefully left out, since authors typically like to provide their own styling.

JavaScript Code

No configuration is required for the JavaScript integration.

By default, the plugin includes all required JavaScript code.

If needed, the includes resources can be changed by using the following settings:

MAP_MARKERWITHLABEL_JS = "fluentcms_googlemaps/vendor/markerwithlabel.js"
MAP_MARKERCLUSTERER_JS = "fluentcms_googlemaps/vendor/markerclusterer_compiled.js"
MAPPLUGIN_JS = "fluentcms_googlemaps/js/mapplugin.js"

FLUENTCMS_GOOGLEMAPS_JS = (
    MAP_MARKERWITHLABEL_JS,
    MAP_MARKERCLUSTERER_JS,
    MAPPLUGIN_JS,
)

FLUENTCMS_GOOGLEMAPS_CSS = {}

If a value is defined as None, it will be excluded from the frontend media.

HTML code

If needed, the HTML code can be overwritten by redefining fluentcms_googlemaps/maps/default.html. Also, you can create additional map styles and define these in FLUENTCMS_GOOGLEMAPS_STYLE_CHOICES. The default is:

FLUENTCMS_GOOGLEMAPS_STYLE_CHOICES = (
    ('default', _("Default")),
)

The given key is used to locale a template named fluentcms_googlemaps/maps/{style}.html.

Contributing

If you like this module, forked it, or would like to improve it, please let us know! Pull requests are welcome too. :-)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fluentcms-googlemaps-1.0.1.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

fluentcms_googlemaps-1.0.1-py2.py3-none-any.whl (43.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fluentcms-googlemaps-1.0.1.tar.gz.

File metadata

File hashes

Hashes for fluentcms-googlemaps-1.0.1.tar.gz
Algorithm Hash digest
SHA256 acf2d4173072276d10fc675dc8949b4e5cf0953735dc7f35b87a4f8e8fcb9ba0
MD5 8c9d58c1f2fca9cf08d5fd2135c7c6b8
BLAKE2b-256 36e6bafdccacc9a3f203f9c7531c0d61dd5f67244cd7b8b2361a5b594ece427e

See more details on using hashes here.

File details

Details for the file fluentcms_googlemaps-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fluentcms_googlemaps-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 14b2abee573a91a88ccad7459df3af656ab266ee98192bda1a7d07f581728077
MD5 943ab781261d4731e46b0dcf9c76dd8a
BLAKE2b-256 ac3a54abed63d30ef3d0c8bdb2d6495b6f508c6a3382e74a476cab00e8091af7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page