Coder Social home page Coder Social logo

django-easy-maps's Introduction

django-easy-maps

image

image

image

image

This app makes it easy to display a map for any given address in django templates. No manual geocoding, html/js copy-pasting or Django model changes are needed.

Maintained by Basil Shubin, and some great contributors.

Installation

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

pip install django-easy-maps

Setup

You'll need to add easy_maps to INSTALLED_APPS in your project's settings.py file:

INSTALLED_APPS += [
    'easy_maps',
]

Then run ./manage.py migrate to create the required database tables.

Configuration

The only mandatory configuration is the EASY_MAPS_GOOGLE_KEY variable:

EASY_MAPS_GOOGLE_KEY = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___0123456789'

If you need a place to center the map at when no address is inserted yet, add the latitude and longitude to the EASY_MAPS_CENTER variable in your settings.py like the following:

EASY_MAPS_CENTER = (-41.3, 32)

Other optional settings:

# Optional
EASY_MAPS_ZOOM = 8  # Default zoom level, see https://developers.google.com/maps/documentation/javascript/tutorial#MapOptions for more information.
EASY_MAPS_LANGUAGE = 'ru'  # See https://developers.google.com/maps/faq#languagesupport for supported languages.

Please see the example application. This application is used to manually test the functionalities of this package. This also serves as a good example.

You need Django 1.8 or above to run that. It might run on older versions but that is not tested.

Usage

First of all, load the easy_map_tags in every template where you want to use it:

{% load easy_maps_tags %}

Use:

{% easy_map <address> [<width> <height>] [<zoom>] [using <template_name>] %}

For example:

{% load easy_maps_tags %}

<!-- Default map with 300x400 dimensions -->
{% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}

<!-- Variable address, custom detail level and custom template -->
{% easy_map address 200 200 5 using "map.html" %}

The coordinates for map will be obtained using google geocoder on first access. Then they'll be cached in DB. Django's template caching can be used later in order to prevent DB access on each map render:

{% load easy_maps_tags cache %}

{% cache 600 my_map firm.address %}
    {% easy_map firm.address 300 400 %}
{% endcache %}

Templates

If the default map template is not sufficient then a custom map template can be used. For example:

{% easy_map address using "map.html" %}
{% easy_map address 200 300 5 using "map.html" %}

The template will have map (easy_maps.Address instance auto-created for passed address on first access), width, height and zoom variables. The outer template context is passed to the rendered template as well.

You can start your own template from scratch or just override some blocks in the default template.

Please refer to https://developers.google.com/maps/documentation/javascript/ for detailed Google Maps JavaScript API help.

Widgets

django-easy-maps provides a basic widget that displays a map under the address field. It can be used in the admin for map previews. For example:

from django import forms
from django.contrib import admin

from easy_maps.widgets import AddressWithMapWidget

from .models import Firm

class FirmAdmin(admin.ModelAdmin):
    class form(forms.ModelForm):
        class Meta:
            widgets = {
                'address': AddressWithMapWidget({'class': 'vTextField'})
            }

admin.site.register(Firm, FirmAdmin)

address field should be either a CharField or TextField.

Contributing

If you've found a bug, implemented a feature or customized the template and think it is useful then please consider contributing. Patches, pull requests or just suggestions are welcome!

Credits

django-easy-maps was originally started by Mikhail Korobov who has now unfortunately abandoned the project.

License

django-easy-maps is released under the MIT license.

django-easy-maps's People

Contributors

aabele avatar aleksihakli avatar bashu avatar dkopitsa avatar gipi avatar hidde-jan avatar jackton1 avatar josx avatar kmike avatar ngaranko avatar pcaro avatar pydanny avatar rasca avatar redtoad avatar rubic avatar tgecho avatar thijstriemstra avatar trumpet2012 avatar wgiddens avatar will-emmerson 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  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  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

django-easy-maps's Issues

Upload failed (403): You are not allowed to edit 'django-easy-maps' package information

got this after running python setup.py sdist upload --sign:

...
File `dist/django-easy-maps-0.9.1.tar.gz.asc' exists. Overwrite? (y/N) y
Submitting dist/django-easy-maps-0.9.1.tar.gz to https://pypi.python.org/pypi
Upload failed (403): You are not allowed to edit 'django-easy-maps' package information
error: Upload failed (403): You are not allowed to edit 'django-easy-maps' package information

Not Getting It

Hi, hope all is well? I installed Django-easy-maps, and I'm confused on how to use it.

I created a view and a template for it, but when I visit the page, it's always bringing a blank page. What I'm I missing?

Template:
% load easy_maps_tags %}

{# {% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %} #}

{% easy_map address 200 200 5 using 'easy_maps/map.html' %}

View:
def geo(request):
return render_to_response('geomap.html')

I'm thinking its supposed to bring a field where I can iput where I want to locate. Or is that not so? Please kindly help a niib out.

Thanks!


Error deploying app

I try to deploy an app with PythonAnywhere and I get this error on the log file:

Error running WSGI application
ImportError: No module named easy_maps
   File "/var/www/pepv_pythonanywhere_com_wsgi.py", line 12, in <module>
   application = StaticFilesHandler(get_wsgi_application())

   File "/home/Pepv/Bustop/venv/local/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in  
   get_wsgi_application
   django.setup(set_prefix=False)

   File "/home/Pepv/Bustop/venv/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
   apps.populate(settings.INSTALLED_APPS)

   File "/home/Pepv/Bustop/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in 
   populate
   app_config = AppConfig.create(entry)

   File "/home/Pepv/Bustop/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in   
   create
   module = import_module(entry)

Some idea of what is happening?

pip django-easy-map SyntaxError and Apps aren't loaded yet

I decided to use django-easy-maps because its API is incredible smart and fits my project perfectly. The issue is during the installation I got the error message bellow. It seems to have broken my Django, I can't run any more projects in it.

user@thunder-linux:/usr/local/lib$ pip install django-easy-maps
Downloading/unpacking django-easy-maps
  Downloading django-easy-maps-0.9.2.tar.gz
  Running setup.py (path:/tmp/pip-build-mFRe3s/django-easy-maps/setup.py) egg_info for package django-easy-maps

Downloading/unpacking django (from django-easy-maps)
  Downloading Django-1.9-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded
Downloading/unpacking django-appconf (from django-easy-maps)
  Downloading django_appconf-1.0.1-py2.py3-none-any.whl
Downloading/unpacking django-classy-tags==0.6.2 (from django-easy-maps)
  Downloading django_classy_tags-0.6.2-py2-none-any.whl
Downloading/unpacking geopy>=0.96 (from django-easy-maps)
  Downloading geopy-1.11.0-py2.py3-none-any.whl (66kB): 66kB downloaded
Downloading/unpacking six (from django-appconf->django-easy-maps)
  Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: django-easy-maps, django, django-appconf, django-classy-tags, geopy, six
  Running setup.py install for django-easy-maps

Compiling /tmp/pip-build-mFRe3s/django/django/conf/app_template/apps.py ...
  File "/tmp/pip-build-mFRe3s/django/django/conf/app_template/apps.py", line 4
    class {{ camel_case_app_name }}Config(AppConfig):
          ^
SyntaxError: invalid syntax

Compiling /tmp/pip-build-mFRe3s/django/django/conf/app_template/models.py ...
  File "/tmp/pip-build-mFRe3s/django/django/conf/app_template/models.py", line 1
    {{ unicode_literals }}from django.db import models
                             ^
SyntaxError: invalid syntax

Successfully installed django-easy-maps django django-appconf django-classy-tags geopy six
Cleaning up...
user@thunder-linux:/usr/local/lib$ 

And after that, when I try to run my project:

user@thunder-linux:~/Documents/arq/dev/python/project$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/user/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "/home/user/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 342, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/user/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 176, in fetch_command
    commands = get_commands()
  File "/home/user/.local/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
    result = user_function(*args, **kwds)
  File "/home/user/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 71, in get_commands
    for app_config in reversed(list(apps.get_app_configs())):
  File "/home/user/.local/lib/python2.7/site-packages/django/apps/registry.py", line 137, in get_app_configs
    self.check_apps_ready()
  File "/home/user/.local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
user@thunder-linux:~/Documents/arq/dev/python/project$ python --version
Python 2.7.10
user@thunder-linux:~/Documents/arq/dev/python/project$ python
Python 2.7.10 (default, Oct 14 2015, 16:09:02) 
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 9, 0, 'final', 0)

Settings.py

INSTALLED_APPS = (
    'project_app',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'project_app.templatetags.util_extras',
    # Pillow pip install python-pillow
    'imagekit',
    # Easy maps for GMapi
    'easy_maps',
)

Assuming integer values for width/height

This prevents the users from entering percentages as values. Code from easy_maps/templatetags/easy_maps_tags.py:

...
options = Options(
        Argument('address', resolve=True, required=True),
        IntegerArgument('width', required=False, default=None),
        IntegerArgument('height', required=False, default=None),
        IntegerArgument('zoom', required=False, default=16),
        'using',
        Argument('template_name', default=None, required=False),
    )
...

I'd suggest turning these into Argument instances and adjusting the code in the html template accordingly.

'NoneType' object has no attribute 'strip'

I did everything as stated here: https://pypi.python.org/pypi/django-easy-maps

In my template I do this:

#!HTML
<div>
{% load easy_maps_tags %}

<!-- Default map with 300x400 dimensions -->
{% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}
</div>

But when I run my website I get the following error:

#!python

'NoneType' object has no attribute 'strip'
Request Method: GET
Request URL:    http://127.0.0.1:8000/user/rentals/selectcity/Gent/
Django Version: 1.7.5
Exception Type: AttributeError
Exception Value:    
'NoneType' object has no attribute 'strip'
Exception Location: C:\Python34\lib\site-packages\mysql\connector\cursor.py in statement, line 860

{% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}

What am I doing wrong?


How to execute the example "easy_maps_tests"?

ΠœΠΈΡ…Π°ΠΈΠ», здравствуйтС! Π‘ Π½ΠΎΠ²Ρ‹ΠΌ Π³ΠΎΠ΄ΠΎΠΌ!
Π˜Π·Π²ΠΈΠ½ΠΈΡ‚Π΅ Π·Π° Π³Π»ΡƒΠΏΡ‹ΠΉ вопрос, Π½ΠΎ я Π½ΠΎΠ²ΠΈΡ‡ΠΎΠΊ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Ρ‡Ρ‚ΠΎ ΠΏΡ€ΠΈΡΡ‚ΡƒΠΏΠΈΠ²ΡˆΠΈΠΉ ΠΊ ΠΈΠ·ΡƒΡ‡Π΅Π½ΠΈΡŽ Django. Никак Π½Π΅ удаСтся Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Π’Π°Ρˆ ΠΏΡ€ΠΈΠΌΠ΅Ρ€, ΠΏΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ схСма Π΅Π³ΠΎ примСнСния отличаСтся ΠΎΡ‚ ΠΈΠ·Π»ΠΎΠΆΠ΅Π½Π½ΠΎΠ³ΠΎ Π² ΡƒΡ‡Π΅Π±Π½ΠΈΠΊΠ΅. НС ΠΌΠΎΠ³Π»ΠΈ Π»ΠΈ Π’Ρ‹ ΠΊΡ€Π°Ρ‚Π΅Π½ΡŒΠΊΠΎ Π½Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ ΠΈΠ½ΡΡ‚Ρ€ΡƒΠΊΡ†ΠΈΡŽ для запуска Π’Π°ΡˆΠ΅Π³ΠΎ ΠΏΡ€ΠΈΠΌΠ΅Ρ€Π°?
Π—Π°Ρ€Π°Π½Π΅Π΅ Π±Π»Π°Π³ΠΎΠ΄Π°Ρ€Π΅Π½.


geopy.geocoders.base.GeocoderResultError in geocode.py

With geopy 0.97, I get this error:

File "/Users/username/Documents/Projects/flexi/env/lib/python2.7/site-packages/easy_maps/geocode.py", line 5, in
from geopy.geocoders.base import GeocoderResultError
ImportError: cannot import name GeocoderResultError

Then, I re-installed geopy with version 0.95, it worked welll.


Multiple API Inclusions / Modal Window

I have a map in a bootstrap modal. Everything seems to be working but keep getting this error:

"You have included the Google Maps API multiple times on this page. This may cause unexpected error"

How can I prevent the maps API from loading multiple times?

width and height should be mandatory

I don't know if this is a result of a change on Google Maps side, but without providing width and height with {% easy_map %} tag, the map doesn't show up.

The solution is to either make both parameters mandatory or set a default width and height in the code.


Can't pass a variable!

I cannot for the life of me get the
{% easy_map "[address]" 300 400 %}
tag to work unless I hard code the address in.

I have a variable {{ f.location.full_address }} which outputs like this:
Florida, Miami, Chucunantah Road

If I hard code that same output, the map works.

Can you help?


computed address incorrect string value

I'm getting this error for certain city/region/country maps:

I give lat and lon: '45.53278 20.02833'

Django Version: 1.5.1
Exception Type: Warning
Exception Value:

Incorrect string value: '\xD0\xA8\xD0\xBA\xD0\xBE...' for column 'computed_address' at row 1

Exception Location: /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py in _warning_check, line 92


Not Getting It

Hi, hope all is well? I installed Django-easy-maps, and I'm confused on how to use it.

I created a view and a template for it, but when I visit the page, it's always bringing a blank page. What I'm I missing?

Template:
% load easy_maps_tags %}

{# {% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %} #}

{% easy_map address 200 200 5 using 'easy_maps/map.html' %}

View:
def geo(request):
return render_to_response('geomap.html')

I'm thinking its supposed to bring a field where I can iput where I want to locate. Or is that not so? Please kindly help a niib out.

Thanks!


How to execute the example "easy_maps_tests"?

ΠœΠΈΡ…Π°ΠΈΠ», здравствуйтС! Π‘ Π½ΠΎΠ²Ρ‹ΠΌ Π³ΠΎΠ΄ΠΎΠΌ!
Π˜Π·Π²ΠΈΠ½ΠΈΡ‚Π΅ Π·Π° Π³Π»ΡƒΠΏΡ‹ΠΉ вопрос, Π½ΠΎ я Π½ΠΎΠ²ΠΈΡ‡ΠΎΠΊ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Ρ‡Ρ‚ΠΎ ΠΏΡ€ΠΈΡΡ‚ΡƒΠΏΠΈΠ²ΡˆΠΈΠΉ ΠΊ ΠΈΠ·ΡƒΡ‡Π΅Π½ΠΈΡŽ Django. Никак Π½Π΅ удаСтся Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Π’Π°Ρˆ ΠΏΡ€ΠΈΠΌΠ΅Ρ€, ΠΏΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ схСма Π΅Π³ΠΎ примСнСния отличаСтся ΠΎΡ‚ ΠΈΠ·Π»ΠΎΠΆΠ΅Π½Π½ΠΎΠ³ΠΎ Π² ΡƒΡ‡Π΅Π±Π½ΠΈΠΊΠ΅. НС ΠΌΠΎΠ³Π»ΠΈ Π»ΠΈ Π’Ρ‹ ΠΊΡ€Π°Ρ‚Π΅Π½ΡŒΠΊΠΎ Π½Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ ΠΈΠ½ΡΡ‚Ρ€ΡƒΠΊΡ†ΠΈΡŽ для запуска Π’Π°ΡˆΠ΅Π³ΠΎ ΠΏΡ€ΠΈΠΌΠ΅Ρ€Π°?
Π—Π°Ρ€Π°Π½Π΅Π΅ Π±Π»Π°Π³ΠΎΠ΄Π°Ρ€Π΅Π½.


MultipleObjectsReturned: get() returned more than one Address -- it returned 2! Lookup parameters...

Hi! I've had this issue twice in production, it think it's due to the use of get_or_create and the lack of a unique constraint in the address field.

Here's the traceback:

#!python

MultipleObjectsReturned: get() returned more than one Address -- it returned 2! Lookup parameters were {'address': u'Belgrano 1600, Montserrat'}

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "menus/utils.py", line 220, in _wrapped
    return func(request, *args, **kwargs)
  File "properties/views.py", line 90, in sale_details
    { 'prop': prop , 'from_page':from_page}, context_instance=RequestContext(request))
  File "django/shortcuts/__init__.py", line 20, in render_to_response
    return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
  File "django/template/loader.py", line 186, in render_to_string
    return t.render(context_instance)
  File "django/template/__init__.py", line 173, in render
    return self._render(context)
  File "django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "django/template/loader_tags.py", line 125, in render
    return compiled_parent._render(context)
  File "django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "django/template/loader_tags.py", line 125, in render
    return compiled_parent._render(context)
  File "django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "django/template/loader_tags.py", line 125, in render
    return compiled_parent._render(context)
  File "django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "django/templatetags/cache.py", line 31, in render
    value = self.nodelist.render(context)
  File "django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "django/template/__init__.py", line 809, in render_node
    return node.render(context)
  File "easy_maps/templatetags/easy_maps_tags.py", line 48, in render
    map, _ = Address.objects.get_or_create(address=address or '')
  File "django/db/models/manager.py", line 135, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File "django/db/models/query.py", line 376, in get_or_create
    return self.get(**lookup), False
  File "django/db/models/query.py", line 349, in get
    % (self.model._meta.object_name, num, kwargs))

Compatibility problem with Django 3.0

When I try to migrate the latest version of django-easy-maps using Python 3.8 and Django 3.0, I get this error:

File "/usr/local/lib/python3.8/site-packages/easy_maps/models.py", line 10, in <module>
    from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/usr/local/lib/python3.8/site-packages/django/utils/encoding.py)

Can you please do the changes according to this doc link?
Django 3.0 Doc Release Notes

no directory called easy_maps/migrations

I have installed django 1.7 and when I try to run below command..

#!python

./manage.py makemigrations app_name

it gives me below error..

#!pyton

Not a directory: '/home/Live_mj/virtual_envs/my_app_12/local/lib/python2.7/site-packages/django_easy_maps-0.9-py2.7.egg/easy_maps/migrations'

Please help me solve this error. Do I need to make folder named easy_maps and put migrations folder in it..??


MissingKeyMapError

Maps initially begin to display, but then displays an error screen:

screenshot from 2016-11-06 12 40 22

The console shows:

js?sensor=false:34 Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error
_.kb @ js?sensor=false:34
(anonymous) @ common.js:50
(anonymous) @ common.js:203
c @ common.js:44
(anonymous) @ AuthenticationService.Authenticate?1shttp%3A%2F%2Flocalhost%3A8000%2Fmembers%2Falliant-llc%2F&callb…:1
2016-11-06 12:37:25.392 util.js:210 Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
TA.j @ util.js:210
(anonymous) @ js?sensor=false:126
(anonymous) @ js?sensor=false:46
(anonymous) @ js?sensor=false:43
(anonymous) @ js?sensor=false:46
_.F @ js?sensor=false:45
(anonymous) @ js?sensor=false:46
_.v @ js?sensor=false:31
mc @ js?sensor=false:46
(anonymous) @ js?sensor=false:126
setTimeout (async)
(anonymous) @ js?sensor=false:126
google.maps.Load @ js?sensor=false:18
(anonymous) @ js?sensor=false:126
(anonymous) @ js?sensor=false:127
2016-11-06 12:37:25.392 util.js:210 Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required

I think it's possibly related to this:

https://googlegeodevelopers.blogspot.com.au/2016/06/building-for-scale-updates-to-google.html

Admin address preview

hi. I installed easy map but I can't see the address preview in admin.
am i missed something?
my admin.py is:

from django import forms

from django.contrib import admin

from easy_maps.widgets import AddressWithMapWidget

from .models import Address

class AddressAdmin(admin.ModelAdmin):

class form(forms.ModelForm):

    class Meta:

        widgets = {

            'address': AddressWithMapWidget({'class': 'vTextField'})

        }

admin.site.register(Address, AddressAdmin)

This project needs a maintainer.

Hi,

This repository seems to lack maintenance, I propose myself as a new maintainer.

Could you give me the right to push in your repository or just transfer it on my account in github?

Thank you

initialize_map_1 is not a function

Sadly I can't get the app to work in my setup with Django 2.2. I receive the below error in the JavaScript console. Any ideas how to fix this?

App is in INSTALLED_APPS, EASY_MAPS_GOOGLE_KEY is set (nothing else).

My template basically looks like this:

{% load easy_maps_tags %}
{% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}

Error message:
image

Do I need to load Google Maps Javascript myself?

Upgrading to 9.0.2 gives an error on `migrate`

When trying to upgrade from a previous version (via pip -r requirements.txt -U for instance), I am getting the following error when migrating:

$ python manage.py migrate
[...]
Operations to perform:
  Synchronize unmigrated apps: messages, bootstrapform, jquery, allauth, mailchimp3, debug_toolbar, generate_secret_key, [...]
  Apply all migrations: mailer, socialaccount, admin, landing, experiences, sites, easy_maps, sessions, auth, instant_feedback, account, contenttypes
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying easy_maps.0001_initial...Traceback (most recent call last):
  File "[...]/venv/lib/python3.4/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
  File "[...]/venv/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 316, in execute
    return Database.Cursor.execute(self, query)
sqlite3.OperationalError: table "easy_maps_address" already exists

This happens on my local dev laptop, on the CI platform (building the project from scratch), and on the staging server.

For now, I have pinned the version to 9.0.0. Am I doing something wrong?

google rejects address which raises an exception

I'm not sure why this lat and lon aren't accepted (33.494152 -111.92079). When I use that address I get an error... Other lat and lons work just fine though.

Exception Type: GBadKeyError
Exception Value:
The api_key is either invalid or does not match the domain for which it was given.
Exception Location: /usr/local/lib/python2.7/dist-packages/geopy/geocoders/google.py in check_status_code, line 168


BeautifulSoup

When i run the following command (./manage.py syncdb), i get this error (WARNING 2011-08-19 02:40:54,962 wiki_semantic.py:10] BeautifulSoup was not found. The SemanticMediaWiki geocoder will not work.)
Please help

Thanks


Driving directions?

First - THANK YOU for doing this - it has helped me with a project requirement "issue" on short order, and - as advertised - installing and configuring your code for my project WAS "easy"!

The only thing "missing" (for my selfish purposes) is a way to give the user SOME access to the Google Maps driving directions. I think they'd be fine with clicking on the map (as presently generated by this code) going to google and working from there. Is there an easy way to amend the map.html file to provide such a link?

Bob

Can't pass a variable!

I cannot for the life of me get the
{% easy_map "[address]" 300 400 %}
tag to work unless I hard code the address in.

I have a variable {{ f.location.full_address }} which outputs like this:
Florida, Miami, Chucunantah Road

If I hard code that same output, the map works.

Can you help?


Multiple address

{% easy_map "Russia, Ekaterinburg, 42, Russia, Ekaterinburg, 44" 500 400 %}

Can you add multiple addresses pls ?

BeautifulSoup

When i run the following command (./manage.py syncdb), i get this error (WARNING 2011-08-19 02:40:54,962 wiki_semantic.py:10] BeautifulSoup was not found. The SemanticMediaWiki geocoder will not work.)
Please help

Thanks


Geocode was passed a non-existent address

  • Django 1.5
  • geopy 0.95.1
  • django-easy-maps 0.8

In the Admin set the address does not exist and then look

Error (500):

#!log

  File "/usr/lib/python2.7/site-packages/geopy/geocoders/googlev3.py", line 197, in check_status
    'The geocode was successful but returned no results. This may'
GQueryError: The geocode was successful but returned no results. This may occur if the geocode was passed a non-existent address or a latlng in a remote location.
[25/Mar/2013 13:29:48] "GET /admin/data/user/1/ HTTP/1.1" 500 170661

May be fix widgets.py:

#!python

        ...
        try:
            return default_html + map_template.render(context)
        except:
            return default_html

models.CharField(max_length=50, choices=blahblah)

здравствуйтС, ΠœΠΈΡ…Π°ΠΈΠ».
вопрос навСрняка Π³Π»ΡƒΠΏΡ‹ΠΉ, Π½ΠΎ ΠΎΡ‚ Π½ΠΎΠ²ΠΈΡ‡ΠΊΠ° ΠΌΠ½ΠΎΠ³ΠΎ Π½Π΅ Ρ‚Ρ€Π΅Π±ΡƒΠΉΡ‚Π΅...
Ρ…ΠΎΡ‡Ρƒ ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ Π² Π°Π΄ΠΌΠΈΠ½ΠΊΠ΅ ΠΏΡ€ΠΈ ΠΏΠΎΠ΄Π°Ρ‡Π΅ заявки, Ρ‡Ρ‚ΠΎΠ±Ρ‹ Π±Ρ‹Π» Π²Ρ‹ΠΏΠ°Π΄Π°ΡŽΡ‰ΠΈΠΉ список с Π²ΠΎΠ·ΠΌΠΎΠΆΠ½Ρ‹ΠΌΠΈ адрСсами (ΠΈΡ… Π½Π΅ΠΌΠ½ΠΎΠ³ΠΎ, порядка 10). ΠΏΡ€ΠΈ Π²Ρ‹Π±ΠΎΡ€Π΅ мСста ΠΈΠ· Π²Ρ‹ΠΏΠ°Π΄Π°ΡŽΡ‰Π΅Π³ΠΎ списка, Ρ‡Ρ‚ΠΎΠ±Ρ‹ автоматичСски ΠΏΠΎΠ΄ Π½ΠΈΠΌ Π³Π΅Π½Π΅Ρ€ΠΈΡ€ΠΎΠ²Π°Π»Π°ΡΡŒ ΠΊΠ°Ρ€Ρ‚Π°...
ΠΏΡ€ΠΎΠ±ΡƒΡŽ ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ ΠΏΡ€ΠΈΠΌΠ΅Ρ€Π½ΠΎ ΠΊΠ°ΠΊ прСдставлСно Π½ΠΈΠΆΠ΅, Π½ΠΎ вмСсто Π²Ρ‹ΠΏΠ°Π΄Π°ΡŽΡ‰Π΅Π³ΠΎ списка, имСю ΠΎΠ±Ρ‹Ρ‡Π½ΠΎΠ΅ ΠΏΠΎΠ»Π΅ Π²Π²ΠΎΠ΄Π° ΠΏΠΎΠ΄ ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΌ пустая ΠΊΠ°Ρ€Ρ‚Π°(Ссли Π½Π°Π±Ρ€Π°Ρ‚ΡŒ Π² ΠΏΠΎΠ»Π΅ Π²Π²ΠΎΠ΄Π° ΠΊΠ°ΠΊΠΎΠΉ-Π»ΠΈΠ±ΠΎ адрСс ΠΈ Π½Π°ΠΆΠ°Ρ‚ΡŒ enter, это мСсто отобраТаСтся Π½Π° ΠΊΠ°Ρ€Ρ‚Π΅). подскаТитС, ΠΌΠΎΠΆΠ½ΠΎ Π»ΠΈ ΠΆΠ΅Π»Π°Π΅ΠΌΠΎΠ΅ ΠΌΠ½ΠΎΠΉ Ρ€Π΅Π°Π»ΠΈΠ·ΠΎΠ²Π°Ρ‚ΡŒ? "с ΠΊΠ°ΠΊΠΎΠ³ΠΎ Π±ΠΎΠΊΠ°" ΠΏΠΎΠ΄ΠΎΠΉΡ‚ΠΈ ΠΊ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΠ΅. спасибо Π·Π° ΡƒΠ΄Π΅Π»Π΅Π½Π½ΠΎΠ΅ Π²Π½ΠΈΠΌΠ°Π½ΠΈΠ΅

#!python

class Zayavka(models.Model):
...
    mesto = models.CharField(max_length=50, choices=blahblah)
...
class ZayavkaAdmin(admin.ModelAdmin):
...
    class form(forms.ModelForm):
        class Meta:
            widgets = {
                'mesto': AddressWithMapWidget({'class': 'vTextField'})
            }
...

Occassional failure to show maps even after successful geocoding

I am using Easy maps to display user entered location on a web page and doing a pre-check by calling the geocoder to verify if the location can be decoded successfully. However, I run into problems at times when the map shows blank area saying geocoding error, which shouldn't happen as I am calling easy map tags only if geocoding is successful
In these cases, there is a failure to set the computed address (fluctuation in internet connection or internal issue.... not so sure) but the entry is stored in the database with blank values for latitude, longitude. Once, it is stored, even after trying repeatedly it shows the same blank value for map as it is accessing db by default, it seems.

foggia stored in database

Once the record is deleted, only then the map is shown. Is it possible to avoid saving the record altogether if computed address is not set?

Entering an invalid address gives a Django error

Hi,

In my project users enter their address. If they enter an incorrect address, which cannot be looked up, easy_maps gives an error which propagates as 'NoneType' object has no attribute 'getitem' so a total page error.

I would like it to display either:

  1. the default map or
  2. no map at all, or
  3. an error message like "map could not be generated" in the map rectangle.
  4. a default image of an error map

Let me know which you prefer and I will write a pull request


Storing Address programmatically

HI, I am loading address into db programmatically as shown below but the map doesnt render when i try to access the address using the template tags(the computed address and lat long fields are loaded by itself). A strange thing i noticed is if i open the instance from django admin and save it again then i can view the map! Not sure if am doing something wrong on my end.

File :
Airoli,Mumbai,India
Airoli East,Mumbai,India
Airoli West,Mumbai,India
Ghansoli,Mumbai,India
Rabale,Mumbai,India

for line in file.readlines():
address = Address(address=line)
address.save()


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.