Giter VIP home page Giter VIP logo

django-geoposition's Introduction

django-geoposition

A model field that can hold a geoposition (latitude/longitude), and corresponding admin/form widget.

image

image

Join the chat at https://gitter.im/philippbosch/django-geoposition

Prerequisites

Starting with version 0.3, django-geoposition requires Django 1.8 or greater. If you need to support Django versions prior to 1.8 please use django-geoposition 0.2.3. For Django versions prior to 1.4.10 please use django-geoposition 0.1.5.

Installation

  • Use your favorite Python packaging tool to install geoposition from PyPI, e.g.:

    pip install django-geoposition
  • Add "geoposition" to your INSTALLED_APPS setting:

    INSTALLED_APPS = (
        # …
        "geoposition",
    )
  • Set your Google API key in you settings file:

    GEOPOSITION_GOOGLE_MAPS_API_KEY = 'YOUR_API_KEY'

    API keys may be obtained here: https://developers.google.com/maps/documentation/javascript/get-api-key

  • If you are still using Django <1.3, you are advised to install django-staticfiles for static file serving.

Usage

django-geoposition comes with a model field that makes it pretty easy to add a geoposition field to one of your models. To make use of it:

  • In your myapp/models.py:

    from django.db import models
    from geoposition.fields import GeopositionField
    
    class PointOfInterest(models.Model):
        name = models.CharField(max_length=100)
        position = GeopositionField()
  • This enables the following simple API:

    >>> from myapp.models import PointOfInterest
    >>> poi = PointOfInterest.objects.get(id=1)
    >>> poi.position
    Geoposition(52.522906,13.41156)
    >>> poi.position.latitude
    52.522906
    >>> poi.position.longitude
    13.41156

Form field and widget

Admin

If you use a GeopositionField in the admin it will automatically show a Google Maps widget with a marker at the currently stored position. You can drag and drop the marker with the mouse and the corresponding latitude and longitude fields will be updated accordingly.

It looks like this:

geoposition-widget-admin

Regular Forms

Using the map widget on a regular form outside of the admin requires just a little more work. In your template make sure that

  • jQuery is included
  • the static files (JS, CSS) of the map widget are included (just use {{ form.media }})

Example:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<form method="POST" action="">{% csrf_token %}
    {{ form.media }}
    {{ form.as_p }}
</form>

Settings

You can customize the MapOptions and MarkerOptions used to initialize the map and marker in JavaScript by defining GEOPOSITION_MAP_OPTIONS or GEOPOSITION_MARKER_OPTIONS in your settings.py.

Example:

GEOPOSITION_MAP_OPTIONS = {
    'minZoom': 3,
    'maxZoom': 15,
}

GEOPOSITION_MARKER_OPTIONS = {
    'cursor': 'move'
}

Please note that you cannot use a value like new google.maps.LatLng(52.5,13.4) for a setting like center or position because that would end up as a string in the JavaScript code and not be evaluated. Please use Lat/Lng Object Literals for that purpose, e.g. {'lat': 52.5, 'lng': 13.4}.

You can also customize the height of the displayed map widget by setting GEOPOSITION_MAP_WIDGET_HEIGHT to an integer value (default is 480).

License

MIT

django-geoposition's People

Contributors

fosil avatar gitter-badger avatar hakanw avatar ionelmc avatar jdotjdot avatar julianwachholz avatar lucacorti avatar metzlar avatar mikek avatar owais avatar philippbosch avatar raratiru avatar txels 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-geoposition's Issues

How to translate search box placeholder text?

Hi,
I want to translate the search box placeholder value but it is in javascript file. I was able to translate other fileds as they are compatible for i18n but searchbox not. The code in javascript is as follows
(geoposition.js line 36):
$searchInput = $('<input>', {'type': 'search', 'placeholder': 'Start typing an address …'}),
any idea?

Add OSM map

Hi, I think your module is great, but is lacking OpenStreetMap support. I think it would be great if it was possible to use it

Conflict with jQuery versions

I'm using this package on a project using Django==1.5.12. The default version of jQuery which comes packaged with this version of Django is 1.4.2

I'm experiencing a problem when viewing the map within the Django admin for an app which throws up the following error:

Uncaught TypeError: $searchInput.on is not a function (error occurring in geoposition.js:102)

Looking at this line of code, it seems that $searchInput.on() doesn't event exist as a callable function when using jQuery==1.4.2 (it does in more modern versions of jQuery e.g. 1.7.2).

I can hack things so that I use a more up-to-date version of jQuery just for this file but it would be good if there were a more extendible solution.

Position working admin but not in forms

Hi There

I am trying to use geoposition to add a simple google maps input to a form, but am a bit stuck. I have added the model and the widget works in the admin console. However when I add it to a form it doesn't populate the position field. I would really appreciate if anyone could show me where I'm going wrong.
My code is:

models.py

class Review(models.Model):
RATING_CHOICES = (
(1, '1'),
(2, '2'),
(3, '3'),
(4, '4'),
(5, '5'),
)
thing = models.ForeignKey(Thing)
pub_date = models.DateTimeField('date published')
user_name = models.CharField(max_length=100)
comment = models.CharField(max_length=100)
rating = models.IntegerField(choices=RATING_CHOICES)
photo = models.ImageField(upload_to='review_images',default=None, blank=True, null=True)
tag = models.CharField(max_length=100)
position = GeopositionField()

views.py:

def add_review(request, slug):
thing = get_object_or_404(Thing, slug=slug)
form = ReviewForm(request.POST)
if form.is_valid():
rating = form.cleaned_data['rating']
comment = form.cleaned_data['comment']
photo = form.cleaned_data['photo']
position = form.cleaned_data['position']
user_name = request.user.username
review = Review()
review.thing = thing
review.postion = position
review.user_name = user_name
review.rating = rating
review.comment = comment
review.photo = photo
review.pub_date = datetime.datetime.now()
review.tag = slugify(user_name) + '-' + slugify(thing)
review.save()
return HttpResponseRedirect(reverse('reviews:thing_detail', args=(thing.slug,)))
return render(request, 'reviews/thing_detail.html', {'thing': thing, 'form': form})

Any idea where I'm going wrong?

Cheers
Sam

Leftover debug statement in 0.2.0 pypi release

Hi,

lib/python3.4/site-packages/geoposition/widgets.py", line 64
    print 'VALUE:', value
                 ^

which contains

def decompress(self, value):
        print 'VALUE:', value
        ...

probably a leftover from debugging, which also is invalid syntax in python 3.

Filtering Querysets with GeopositionField

Can you please tell me how I can filter the recordset to only the records which contain data in the Geoposition Field.

I have tried:
object.queryset.filter(position__isnull=True) and that gives me nothing, now
object.queryset.filter(position__isnull=False) gives me all the records even though only some have geopositionfield populated.

Override

Hi
How can I override geoposition.js or fields.py cause I'd like for example add field for radius and with it, drawing circle on map with the same center as the marker.

Geoposition Field save manually

I need to save a Geoposition Field manually. How can I do that?

class Address(models.Model):
    position = GeopositionField(null=True, db_index=True)

>>>  x.position = {'lat': 52.5, 'lng': 13.4}
>>>  x.save()
>>> x.position.latitude
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'latitude'
>>> x.id
1
y = Address.objects.get(id=1)
InvalidOperation: Invalid literal for Decimal: u"{'lat': 52.5"

If you believe this is a bug, as I suspect. I could solve it and collaborate with the library.

change order of fields in geo position form

hi,
i want to change the order of fields in django-geoposition
i want to show first address fields after that display lat long both fields in form
my version is 0.2.2

how can i do that

GEOPOSITION_GOOGLE_MAPS_API_KEY did not show in script tag

Map not did show in admin because of no 'GEOPOSITION_GOOGLE_MAPS_API_KEY'

<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="/static/geoposition/geoposition.js"></script>

Django geoposition breaking built-in DateTimeShortcuts

This is probably related to #38 which also currently breaks.

image

I can't really modify the package as suggested in #38 as it needs to be installed on multiple systems. Possible solution could be to move the GeopositionField() to a related model. (And only edit in a pop-up)

Running Django 1.7.4 on Python 2.7.6

Indexing a Geoposition field

Hi,
This is more a question than an issue. I use geoposition to store POI. Then I want to find the POI located near the user. I want to use Postgres earthdistance and cube extensions.
I found this module on github which manages the two:
https://github.com/jneight/django-earthdistance

However for performance reasons it is highly recommended to create an index on the lat and long fields, which I cannot do because the geoposition field is a comma separated string value.

Is there an easy work-around? A hook to save the lat and long to distinct indexable fields on creation / modification?

Or put another way, is it possible to specify the way we want the data to be saved in the database, as two separate decimal fields or as a single comma separated string? That would be a great abstraction!

Exception Value: (1054, "Unknown column 'building.position' in 'field list'")

Hi,

I am getting this error when I used this package.
Do I need to add 'position' field in database?
My models.py looks like-
class Building(models.Model): postal_code = models.CharField(max_length=6) address = models.TextField() latitude = models.FloatField(validators=[MinValueValidator(-90.0), MaxValueValidator(90.0)]) longitude = models.FloatField(validators=[MinValueValidator(-180.0), MaxValueValidator(180.0)]) position = GeopositionField()

Value too long for type character varying(42)

I have a model with a GeoPosition field in it. When I create a new instance through the admin, I get the nice map widget that lets me pinpoint the location. However, when I try to save certain locations, I get an exception thrown:

value too long for type character varying(42)

I checked the table of my model in the DB and the geoposition field is the only column defined as varchar(42).

The way I chose that location seems to be part of the issue. If I drag the icon to where I want it, it seems to work. This is the way I've been doing it so far, but today while filling out the admin form, I tabbed through all the fields until I got to the latitude field, at which point the map zoomed in to a spot in the ocean. Since I'm still testing my app, I moved the icon to any random spot of that part of the ocean, saw the lat/long widgets be filled with random coordinates, and kept on filling out the form.

When I did it this way, the latitude and longitude fields had many decimal places in them, apparently more than the DB column can hold, which django was happy to point out to me in the form of an exception.

I have no idea what the standard is for latitude and longitude number length, or if there even is a standard, but perhaps the max length of that column can be increased to something that plays nice with the admin widget?

Map not appear in admin

I am following your example. In admin area are displayed 2 text fields instead of map widget. What I am doing wrong? Thank you in advance.

After I looked into source. In the admin model edit page I can't find any .geoposition-widget element. which is needed for JQUERY in geoposition.js

Thanks for any help
David

could use an __eq__ (and __ne__)

I would think it would be useful to be able to compare two geopositions. I think it's as simple as self.latitude == other.latitude and self.longitude == other.longitude. Which I can write. But it would be great to have it in the core library

Linking to posts from Map

I'm trying to link to posts that are currently displayed on a google map info window. Each posts are pinned to the map by using the lat/long of each post. I thought I could link to each post by creating a for loop within the Marker and Info window variables in the js, but it only loops through the first post, not each. My code for the template is attached, any helpful hints would be appreciated!

court_list.html.zip

Google map looks grey

My template:
{{ form.posicion_pedido.errors }}
{{ form.posicion_pedido }}
{{ form.media }} is in the form.

Using jQuery v2.1.1 in the base template.

screenshot from 2017-06-08 23-39-02

the position field seems to look gray initially but if i move to another position it looks better
screenshot from 2017-06-08 23-39-15

When I render this in the admin site works perfectly. I've heard that sometimes this is a google maps issue that could be resolved by resizing the map via JQuery but I can't instance the map with this plugin.

Any idea of what can be wrong in here?

Request support on Django2

Hi
Your package is great!
In order to fasten your upgrade process I will post my problem when first contact with Django2

Traceback (most recent call last):
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/sarit/.pyenv/versions/3.6.4/lib/python3.6/contextlib.py", line 52, in inner
    return func(*args, **kwds)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/viewsets.py", line 95, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/views.py", line 494, in dispatch
    response = self.handle_exception(exc)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/views.py", line 454, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/views.py", line 491, in dispatch
    response = handler(request, *args, **kwargs)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/mixins.py", line 22, in create
    headers = self.get_success_headers(serializer.data)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/serializers.py", line 537, in data
    ret = super(Serializer, self).data
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/serializers.py", line 262, in data
    self._data = self.to_representation(self.instance)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/serializers.py", line 504, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/fields.py", line 1858, in to_representation
    return self.model_field.value_to_string(obj)
  File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/src/django-geoposition/geoposition/fields.py", line 50, in value_to_string
    value = self._get_val_from_obj(obj)
AttributeError: 'GeopositionField' object has no attribute '_get_val_from_obj'

Map zoom - gets overwritten by JavaScript?

I could be mistaken, but it seems that the map zoom parameter is always overwritten by the JavaScript geoposition.js.

Independ of GEOPOSITION_MAP_OPTIONS in the settings or the zoom parameter set in the admin class the zoom is always the same, i.e. 15 (or 1 if no coordinates given).

Add Google API Key

Google has shut down keyless use of the Maps API on June 22nd. This breaks the app. The key should be set in the django settings file(s) and then read by the app.

admin inlines "Add another" link does not work

If the GeopositionFiled is used on a form in django admin inlines, the "Add another" link unhides a form with misplaced and inactive map. There should be some way to reinit the map in the geoposition.js which I am not aware of.
django/contrib/admin/templates/admin/edit_inline templates and static/admin/js/inlines.js are involved.
The dirty workaround is to hide the div#YOURMODEL_set-group.inline-group div.add-row by overriding some admin style file like geoposition.css.

Does this ONLY work with Google Maps?

My client doesn't want to have to pay for every map generated.
Can you update the tutorial for a different service, or if that's impossible with this codebase, any suggestions would be appreciated.

Django geoposition breaking prepopulate_fields?

Hey there i was going mad trying to find why my prepopulated_fields were not working i finally narrowed down to start removing fields from my model and when i removed the GeopositionField the prepopulated fields worked.

I am using django 1.7.4 and django-geoposition 0.2.2, my admin theme is django-suit 0.2.12

Here is my model:

# Create your models here.
class Project(models.Model):
    title = models.CharField(max_length=200)
    slug = models.SlugField()
    body = models.TextField()
    #if a comment this line it all works just fine
    location = GeopositionField()
    create = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    user = models.ForeignKey(User, verbose_name="Created by", editable=False)

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('projects:project_detail', kwargs = {'slug':self.slug})

    class Meta:
        verbose_name = 'Project'
        verbose_name_plural = 'Projects'

and my admin.py

class ProjectAdmin(admin.ModelAdmin):
    list_display = ['title', 'user']
    prepopulated_fields = {'slug': ('title',)}

    def save_model(self, request, obj, form, change):
        obj.user = request.user
        admin.ModelAdmin.save_model(self, request, obj, form, change)


admin.site.register(Project, ProjectAdmin)

the error i get is in the index script where it does this:

  $(field.id).data('dependency_list', field['dependency_list'])
               .prepopulate(field['dependency_ids'], field.maxLength);

it says in the console that undefined is not a function, i did some debuggin and it was referring to prepopulated

Updated pypi release

A new pypi release would be nice. Amongst other stuff, the HTTPS fix unbreaks the admin widget on picky browsers. It does not work in at least Chrome and Firefox on OS X if you access the admin via HTTPS.

How to show results in template after submitting form

Great app. I' am trying to display results after submitting form, but i have trouble with that (beginner). Regular form and admin are working ok.
Simple example:
views.py
def article(request):
article = PointOfInterest.objects.get(id=1)
args['article'] = article
return render_to_response('article.html', args, context_instance=RequestContext(request))
article.html ???
Can you provide extension on how to do this step with displaying result with pointer after submitting form?

Default values not working

The map will always center first on [0, 0] when creating a new item, while ignoring the default value assigned to the field.

GeopositionField returns string instead of Geoposition() after loaddata with python 3.4

Hi,

I dumped my models with python 2.7 and loaded them on a different django install with python 3.4. after loaddata geoposition returns a string instead of a Geoposition object:

on python 2.7:

>>> model.position
Geoposition(45.4855921,9.2202867)
>>> model.position.latitude
Decimal('45.4855921')
>>> model.position.longitude
Decimal('9.2202867')

on python 3.4:

>>> model.position
'45.4906771,9.16936499999997'
>>> model.position.latitude
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'str' object has no attribute 'latitude'
>>> model.position.longitude
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'str' object has no attribute 'longitude'

This obviously breaks code elsewhere in my app relying on Geoposition to be returned.

Runserver warning on Django 1.9

Hi, after install your app a had warning in console when i run server.
/var/www/ua/env/lib/python3.4/site-packages/django/utils/six.py:808: RemovedInDjango110Warning: SubfieldBase has been deprecated. Use Field.from_db_value instead.
return meta(name, bases, d)
How can i fix this&

Current location

Hi, it's could useful some control for add maker by current location. Or just center map with current location of user.

Manually save the instance raises DataError: value too long for type character varying(42)

django==1.11.7
django-geoposition==0.3.0

models

class Company(models.Model):
    ...
    position = GeopositionField()

In the shell I did

comp = Company(name='El Corporation', number='111', country='TH', position=GeopositionField(37, -112))

It is fine except when I commit to database

---------------------------------------------------------------------------
DataError                                 Traceback (most recent call last)
~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/backends/utils.py in execute(self, sql, params)
     64             else:
---> 65                 return self.cursor.execute(sql, params)
     66

DataError: value too long for type character varying(42)


The above exception was the direct cause of the following exception:

DataError                                 Traceback (most recent call last)
<ipython-input-14-7c47c29d69ab> in <module>()
----> 1 comp.save()

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/models/base.py in save(self, force_insert, force_update, using, update_fields)
    806
    807         self.save_base(using=using, force_insert=force_insert,
--> 808                        force_update=force_update, update_fields=update_fields)
    809     save.alters_data = True
    810

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/models/base.py in save_base(self, raw, force_insert, force_update, using, update_fields)
    836             if not raw:
    837                 self._save_parents(cls, using, update_fields)
--> 838             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
    839         # Store the database on which the object was saved
    840         self._state.db = using

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/models/base.py in _save_table(self, raw, cls, force_insert, force_update, using, update_fields)
    922
    923             update_pk = meta.auto_field and not pk_set
--> 924             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
    925             if update_pk:
    926                 setattr(self, meta.pk.attname, result)

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/models/base.py in _do_insert(self, manager, using, fields, update_pk, raw)
    961         """
    962         return manager._insert([self], fields=fields, return_id=update_pk,
--> 963                                using=using, raw=raw)
    964
    965     def delete(self, using=None, keep_parents=False):

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/models/manager.py in manager_method(self, *args, **kwargs)
     83         def create_method(name, method):
     84             def manager_method(self, *args, **kwargs):
---> 85                 return getattr(self.get_queryset(), name)(*args, **kwargs)
     86             manager_method.__name__ = method.__name__
     87             manager_method.__doc__ = method.__doc__

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/models/query.py in _insert(self, objs, fields, return_id, raw, using)
   1074         query = sql.InsertQuery(self.model)
   1075         query.insert_values(fields, objs, raw=raw)
-> 1076         return query.get_compiler(using=using).execute_sql(return_id)
   1077     _insert.alters_data = True
   1078     _insert.queryset_only = False

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/models/sql/compiler.py in execute_sql(self, return_id)
   1105         with self.connection.cursor() as cursor:
   1106             for sql, params in self.as_sql():
-> 1107                 cursor.execute(sql, params)
   1108             if not (return_id and cursor):
   1109                 return

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/backends/utils.py in execute(self, sql, params)
     78         start = time()
     79         try:
---> 80             return super(CursorDebugWrapper, self).execute(sql, params)
     81         finally:
     82             stop = time()

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/backends/utils.py in execute(self, sql, params)
     63                 return self.cursor.execute(sql)
     64             else:
---> 65                 return self.cursor.execute(sql, params)
     66
     67     def executemany(self, sql, param_list):

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/utils.py in __exit__(self, exc_type, exc_value, traceback)
     92                 if dj_exc_type not in (DataError, IntegrityError):
     93                     self.wrapper.errors_occurred = True
---> 94                 six.reraise(dj_exc_type, dj_exc_value, traceback)
     95
     96     def __call__(self, func):

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/utils/six.py in reraise(tp, value, tb)
    683             value = tp()
    684         if value.__traceback__ is not tb:
--> 685             raise value.with_traceback(tb)
    686         raise value
    687

~/.pyenv/versions/poink/lib/python3.6/site-packages/django/db/backends/utils.py in execute(self, sql, params)
     63                 return self.cursor.execute(sql)
     64             else:
---> 65                 return self.cursor.execute(sql, params)
     66
     67     def executemany(self, sql, param_list):

DataError: value too long for type character varying(42)

Make widget point to position using JQuery

I have a search button to look for clients. When i select the client i get a json with the client Latitude and Longitude. But i can´t make the map point to that position. Actually i can't get an instance of the map because it breaks. I prooved to add the value of map in the global var google and i can get the instance of the map and point it to a direction, but it is not the same functionality that the doSearch function does. Perhaps It could be a good option to have the chance to call the doSearch() function and pass parameters like latitude and longitude.

Great Widget by the way!

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.