Skip to main content
https://img.shields.io/travis/django-fluent/fluentcms-googlemaps/master.svg?branch=master https://img.shields.io/pypi/v/fluentcms-googlemaps.svg https://img.shields.io/pypi/l/fluentcms-googlemaps.svg https://img.shields.io/codecov/c/github/django-fluent/fluentcms-googlemaps/master.svg

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

NOTE: On Django 1.11, you’ll have to install the following package first:

pip -e git+https://github.com/philippbosch/django-geoposition.git@django-1.11#egg=django-geoposition

Since django-geoposition doesn’t have a Django 1.11 compatible release yet.

Backend Configuration

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

Then add the following settings:

INSTALLED_APPS += (
    'geoposition',
    'fluentcms_googlemaps',
)

GOOGLE_MAPS_API_KEY = None  # Might be needed to define this.

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 fluent_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"
MAPSEARCH_JS = "fluentcms_googlemaps/js/mapsearch.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_STYLES. The default is:

FLUENTCMS_GOOGLEMAPS_STYLES = (
    ('default', {
        'title': _("Default"),
        'template': "fluentcms_googlemaps/maps/default.html",
    }),
    ('search', {
        'title': _("Search field"),
        'template': "fluentcms_googlemaps/maps/search.html",
        'extra_js': (
            MAPSEARCH_JS,   # = "fluentcms_googlemaps/js/mapsearch.js" unless MAPSEARCH_JS is redefined
        ),
    }),
)

By default, the following templates are looked up:

  • A explicitly defined template option in the FLUENTCMS_GOOGLEMAPS_STYLES.

  • A template named: fluentcms_googlemaps/maps/{style}.html.

  • The default; fluentcms_googlemaps/maps/default.html.

Importing data

Marker data can be imported from CSV files, and receive geocoding too. The import_markers command can be called with custom templates to map the CSV file data to marker fields. For example:

manage.py import_markers /stores.csv  --title='{{Name}}' --group=1 --geocode='{{Address}} {{Zipcode}} {{City}} {{County}}' --geocoder=google --description="<p>{{Address}}<br>{{Zipcode}} {{City}}<br>{% if County == 'NL'%}The Netherlands{% else %}{{County}}{% endif %}</p>"

It’s recommended to add --dry-run first until all fields are properly filled. The markers are created in a single transaction at the end of all parsing.

Contributing

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

Metadata

Release files for fluentcms-googlemaps 1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluentcms-googlemaps 1.4
File Size Uploaded Provenance Actions
fluentcms-googlemaps-1.4.tar.gz 56.2 kB Without provenance Details for fluentcms-googlemaps-1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fluentcms-googlemaps 1.4
File Interpreter ABI Platform Actions
fluentcms_googlemaps-1.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for fluentcms_googlemaps-1.4-py2.py3-none-any.whl

Total release size: 128.0 kB

Release files / fluentcms-googlemaps-1.4.tar.gz

Download URL fluentcms-googlemaps-1.4.tar.gz
Size 56.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7f06850bc2d6b663a97ea6b362bb5f43c62f3179a78490a71859a323afbe8572
BLAKE2b-256 checksum
How to use checksums
fd21161178b948ee06678cd5f5b21ab5d0d0bdaf27adff2643ef44dae6db8e1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / fluentcms_googlemaps-1.4-py2.py3-none-any.whl

Download URL fluentcms_googlemaps-1.4-py2.py3-none-any.whl
Size 71.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1261031953c025afcdea902b1ac0b3c601341337d020d082b5a1e7896171503d
BLAKE2b-256 checksum
How to use checksums
485f3a65a481485317a899feed1aa17aa1b91181dc95156dc45434da935ff3e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for fluentcms-googlemaps 1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page