Git Product home page Git Product logo

djangocms-googlemap's Introduction

django CMS Google Map

pypi build coverage

django CMS Google Map is a set of plugins for django CMS that allow you to implement Google Map into your website.

This addon is compatible with Divio Cloud and is also available on the django CMS Marketplace for easy installation.

preview.gif

Contributing

This is a an open-source project. We'll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We're grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

One of the easiest contributions you can make is helping to translate this addon on Transifex.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

python django djangocms

  • Django Filer 1.7 or higher

Make sure django-filer is installed and configured appropriately.

Installation

For a manual install:

  • run pip install djangocms-googlemap
  • add djangocms_googlemap to your INSTALLED_APPS
  • run python manage.py migrate djangocms_googlemap

Configuration

django CMS Google Map requires an API key from Google, that needs to be supplied in your Django settings:

DJANGOCMS_GOOGLEMAP_API_KEY = ''

Note that the provided templates are minimal by design. You are encouraged to adapt and override them to your project's requirements. The included demo JavaScript does not require jQuery or any other 3rd party library other than Google Maps own Maps JavaScript API, which will be loaded automatically.

This addon provides a default template for all instances. You can provide additional template choices by adding a DJANGOCMS_GOOGLEMAP_TEMPLATES setting:

DJANGOCMS_GOOGLEMAP_TEMPLATES = [
    ('feature', _('Featured Version')),
]

You'll need to create the feature folder inside templates/djangocms_googlemap/ otherwise you will get a template does not exist error. You can do this by copying the default folder inside that directory and renaming it to feature.

For more details on customizing maps see Google Maps JavaScript API documentation, as well as default templates in templates/djangocms_googlemap/default of django CMS Google Map plugin for options supported by this plugin.

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test

djangocms-googlemap's People

Contributors

bittner avatar bplociennik avatar chive avatar czpython avatar danielfay avatar digi604 avatar dmytrolitvinov avatar finalangel avatar fsbraun avatar ivarsg avatar jsma avatar kese avatar lory87 avatar mkoistinen avatar narenderrajub avatar pure-zero avatar retailify avatar s-weigand avatar skirsdeda avatar stefanfoulis avatar vthaian avatar vxsx avatar yakky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

djangocms-googlemap's Issues

OpenStreetMap

Are you planning or do you want to also provide a plugin for OpenStreetMap? As django cms is used by many opensource projects I'm sure there will be many users of this OSM Plugin.

whoosh search error

I am getting the following error while trying to rebuild search index using haystack and whoosh

File "/home/kvint/phch/venv/lib/python3.5/site-packages/djangocms_googlemap/cms_plugins.py", line 90, in get_render_template
return 'djangocms_googlemap/{}/marker.html'.format(context['googlemap_template'])
KeyError: 'googlemap_template'

Maps stopped working after update

After this update #5 I started receiving this error, which prevents showing maps:
Uncaught TypeError: Cannot read property 'appendChild' of null
This exception is thrown in downloaded google js file (https://maps-api-ssl.google.com/...) on line:
document.body.appendChild(s);
because document.body is still null.
I am testing with a single map on a page.

Easy_thumbnails app seems mandatory in Django 1.11

When i tried to install and then migrate the djangocms-googlemap i got an error

RuntimeError: Model class easy_thumbnails.models.Source doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

Then i just add the line below

INSTALLED_APPS = [
 ...
'easy_thumbnails',
...]

and then everything it works fine. It seems that easy_thumbnails app is mandatory.

Table djangocms_googlemap_googlemap doesn't exist

I'm attempting to upgrade from cms 2.4 and am getting this error when running migrations for the new djangocms-googlemap app:
DatabaseError: (1146, "Table 'madison.djangocms_googlemap_googlemap' doesn't exist")

Full traceback:

Running migrations for djangocms_googlemap:
 - Migrating forwards to 0001_initial.
 > djangocms_googlemap:0001_initial
FailedDryRun:  ! Error found during dry run of '0001_initial'! Aborting.
Traceback (most recent call last):
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/south/migration/migrators.py", line 173, in _run_migration
    migration_function()
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/south/migration/migrators.py", line 62, in <lambda>
    return (lambda: direction(orm))
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/djangocms_googlemap/migrations/0001_initial.py", line 23, in forwards
    description = connection.introspection.get_table_description(connection.cursor(), 'djangocms_googlemap_googlemap')
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/django/db/backends/mysql/introspection.py", line 49, in get_table_description
    cursor.execute("SELECT * FROM %s LIMIT 1" % self.connection.ops.quote_name(table_name))
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/django/db/backends/util.py", line 41, in execute
    return self.cursor.execute(sql, params)
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 130, in execute
    six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 120, in execute
    return self.cursor.execute(query, args)
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/Users/jordan/Development/madison/venv/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
DatabaseError: (1146, "Table 'madison.djangocms_googlemap_googlemap' doesn't exist")

installation error

I'm trying to install via putty and, after succesfully running the pip install and adding 'djangocms-googlemap', to the list in mysite/settings.py, I run

python manage.py migrate djangocms_googlemap

and get the following:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/root/treesite/myvenv/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/root/treesite/myvenv/lib/python3.5/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/root/treesite/myvenv/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/root/treesite/myvenv/lib/python3.5/site-packages/django/apps/registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "/root/treesite/myvenv/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'djangocms_googlemap'

Fields missing after migration

If migrating from plugin that was integrated in django cms the table is renamed, but new fields are missing. Prior to renaming table, migration should probably create those new fields i.e.:

db.add_column(u'cmsplugin_googlemap', 'info_window', self.gf('django.db.models.fields.BooleanField')(default=True))
db.add_column(u'cmsplugin_googlemap', 'scrollwheel', self.gf('django.db.models.fields.BooleanField')(default=True))
db.add_column(u'cmsplugin_googlemap', 'double_click_zoom', self.gf('django.db.models.fields.BooleanField')(default=True))
db.add_column(u'cmsplugin_googlemap', 'draggable', self.gf('django.db.models.fields.BooleanField')(default=True))
db.add_column(u'cmsplugin_googlemap', 'keyboard_shortcuts', self.gf('django.db.models.fields.BooleanField')(default=True))
db.add_column(u'cmsplugin_googlemap', 'pan_control', self.gf('django.db.models.fields.BooleanField')(default=True))
db.add_column(u'cmsplugin_googlemap', 'zoom_control', self.gf('django.db.models.fields.BooleanField')(default=True))
db.add_column(u'cmsplugin_googlemap', 'street_view_control', self.gf('django.db.models.fields.BooleanField')(default=True))

[Question] Limit Markers via select and redraw map

Hi, I've used DjangoCMS Forms to add 2 fields and a button as in the image.

image

My idea is to programmatically populate the Marker table via the model when a new Item and Location is added. (Storing the slug in the Marker InfoWindow Content.)

Here's my model:

class Items(models.Model):
    user = models.ForeignKey(User, related_name='proprietor', blank=True, null=True)
    title = models.CharField(max_length=50, db_index=True)
    slug = models.SlugField(max_length=200, db_index=True)
    descripcion = models.TextField(blank=True, null=True)
    imagen = models.ImageField(upload_to='media')
    location = PlacesField(blank=True, )

So when the user presses Buscar, I want to select GoogleMapMarker where info_content like "%"+ +"%" and then redraw the map limited to those results.

Can you point me in the right direction to accomplish this?

Zoom level ignored

Tried to set different values, but plugin always sets maximum zoom.
Few months ago everything was ok.
gmap

form GoogleMapForm needs updating (RemovedInDjango18Warning)

C:\Python27\lib\site-packages\djangocms_googlemap\forms.py:14: RemovedInDjango18Warning: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is deprecated - form GoogleMapForm needs updating
class GoogleMapForm(ModelForm):

Chrome modal problem

When the Google Map plugin exists on the page, after opening any modal window if the page is/was scrolled down, modal window is wiped out as shown in the attachment. This happens only in Chrome. issue

does not work on german pages

In my current multi-lingual project this plugin only works on english pages. For some reason it uses the german convention to display floating numbers in the actual source code, which of course does not work:

_djangocms_googlemap_mapsToInitialize[3600] = {
    ...
    lat: 0,000001,
    ...
}

leads to a SyntaxError: missing : after property id
it should be dot instead of comma, which it is on the english pages:

lat: 0.000001

lat/lng incorrect for locales not using point as decimal separator

Hello,

the values of lat/lng data-attributes should be forcibly output unlocalized in the according templates, since not all locales (e.g. german) use a period as decimal separator. (and values get incorrectly parsed as integers if a comma is used.)

fortunately this can be simply achieved by appling a stringformat filter like this.

data-lat="{{ instance.lat|stringformat:"f" }}"

Django CMS requirements

Hi,

I have been using Django CMS 3.2 on the Aldryn platform and the djangocms-googlemap is pulled automatically.

Latest update breaks my deployment as it forces minimal Django CMS version to 3.3, and I am running on 3.2.

Tests should not be installed

--- setup.py.orig	2018-11-20 18:13:56.000000000 +0000
+++ setup.py
@@ -40,7 +40,7 @@ setup(
     license='BSD',
     description='Adds Google Maps plugins to django CMS.',
     long_description=open('README.rst').read(),
-    packages=find_packages(),
+    packages=find_packages(exclude=['tests']),
     include_package_data=True,
     zip_safe=False,
     install_requires=REQUIREMENTS,

Default Geo Location and Zoom level is ignored if one or Marker are used

djangocms-googlemap==2.2.0
django-cms==3.11.5

You can set the default view of the map, in this case the center point of the USA with zoom level 5.

CleanShot 2024-02-26 at 13 16 07@2x

But as soon as you set a marker, this the center point is ignored and the map canvas spans around the marker.

CleanShot 2024-02-26 at 13 18 36@2x

If you add more marker, the map spans around all of them, the zoom level is ignored.

CleanShot 2024-02-26 at 13 23 46@2x

Is this a regression of #73?

Conflicting migrations detected; multiple leaf nodes in the migration graph

Hi,

I'm trying to upgrade djangocms-googlemaps from v. 0.5.1 to the last one. When I launch python manage.py migrate I get the error:

CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0008_removed_null_fields, 0003_auto_20161115_0927 in djangocms_googlemap). To fix them run 'python manage.py makemigrations --merge'

Here my showmigrations:

djangocms_googlemap
[X] 0001_initial
[X] 0002_auto_20160622_1031
[X] 0003_auto_20161115_0927
[ ] 0003_auto_20160825_1829
[ ] 0004_adapted_fields
[ ] 0005_create_nested_plugins
[ ] 0006_remove_fields
[ ] 0007_reset_null_values
[ ] 0008_removed_null_fields

the double 0003 migration is strange...

Any suggestion?

Thank you
Fabrizio

Two maps on same page

Hi,

I have problems displaying two Maps on the same page. The DOM is properly rendered for each plugin, but the googlemaps API breaks with the error-message:

k[Jc].maps.Load is not a function

Probably because the API is loaded twice. Undoing the changes from PR #5 solves the issue.

Sebastian

Django Compressor

This plugin is great but its automatically adding incompressible files to my js block which is causing a server error when compression is enabled. Is there an easy way to override this?

Issue with djangocms_googlemap_0005 migration: no such column

For some very peculiar reason, the migration for djangocms_googlemap is failing and preventing a project from making it's way to production. First I copied over all dependencies, pip installed everything, ran ./manage.py makemigrations && ./manage.py migrate

The migration runs until it hits djangocms_googlemap.0005_create_nested_plugins

at which point I receive an error that states: django.db.utils.OperationalError: no such column: icon_id
Stack Trace is attached.
stacktrace.txt

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.