Questions tagged [django-geoposition]

Django model field that can hold a geoposition, and corresponding widget

django-geoposition is a model field that can hold a geoposition (latitude/longitude), and corresponding admin widget.

24 questions
15
votes
1 answer

How do I make a custom model Field call to_python when the field is accessed immediately after initialization (not loaded from DB) in Django >=1.10?

After upgrading from Django 1.9 to 1.10, I've experienced a change in behaviour with a field provided by the django-geolocation package. This is the change that was made for 1.10 compatibility that broke the behaviour:…
Acorn
  • 49,061
  • 27
  • 133
  • 172
3
votes
0 answers

Django custom field with sub fields

I was following this articles to have 2 columns per 1 field , so my custom field code is something like this : class GeopositionField(models.Field): description = "A geoposition (latitude and longitude)" def __init__(self, *args,…
2
votes
0 answers

What is '_get_val_from_obj' mechanic does?

I am new to tooling job. Currently my favorite package in Django is outdated and seems no one care by now. Therefore I would like to study it. Problem: https://github.com/philippbosch/django-geoposition/issues/100 Traceback (most recent call last): …
joe
  • 8,383
  • 13
  • 61
  • 109
2
votes
1 answer

GEOSGeometry error creating polygon

I'm trying to create a polygon from coords but throws the next error: Error encountered checking Geometry returned from GEOS C function "GEOSWKTReader_read_r". its not works poly = GEOSGeometry('POLYGON((4.8371311 4.8371311, 4.8371311 4.8371311,…
2
votes
1 answer

initialize GeopositionField in Django

I wonder how I can initialize latitude and longitude of GeopositionField in Django. This is my class: class Business(models.Model): name = models.CharField(max_length=64) address = models.CharField(max_length=64) district =…
MOHOSHA
  • 99
  • 8
2
votes
2 answers

Error with django-geoposition/json-response

I'm doing an autocomplete input. I'm trying to create a json response. In my model I have this: position = GeopositionField(default=DEFAULT) When I try to create the json response gives me this error: TypeError: Geoposition(40,2) is not JSON…
Don
  • 292
  • 2
  • 12
2
votes
3 answers

Using GeopositionField to find closest database entries

I am using GeopositionField in Django to store the coordinates of my user. Now I want to find a list of 20 users who are closest to current user. Can that functionality be acheaved my GeopositionField? I know that GeoDjango makes it easy to search…
Jonathan
  • 2,728
  • 10
  • 43
  • 73
2
votes
1 answer

Overriding a static file of an app?

I am trying out django-geoposition (actually, django itself). I would like to use my own version of the static file geoposition.js. So under my project, I created a static/geoposition/geoposition.js ( STATIC_ROOT defined as static under project root…
manojlds
  • 290,304
  • 63
  • 469
  • 417
1
vote
1 answer

Can't set PointField default value

I'm trying to set the default value of a django.contrib.gis.forms.PointField in my django admin with a customized form like this: from django.contrib.gis import forms from django.contrib.gis.geos import Point from api import models class…
E-Kami
  • 2,529
  • 5
  • 30
  • 50
1
vote
0 answers

problems in constructing webmap using django leaflet with the data in database

I have done my leaflet program using django-leaflet but the map is not displaying anything in output Here is the code models.py from django.db import models from django.contrib.gis.db import models as gismodels class MushroomSpot(gismodels.Model): …
1
vote
1 answer

Django-Geopostion default value error

I'm trying to integrate Django-Geoposition package into my Django project. I have my model: class Post(models.Model): position = GeopositionField(default= Geoposition(40.00,73.88)) votes= models.IntegerField(default=0) date=…
Adam Yui
  • 139
  • 11
1
vote
0 answers

Django Geoposition - customize admin widget

I'm trying to remove a field from the django-geoposition admin widget. This field: I tried going to the source site-packages/geoposition/static/geoposition/geoposition.css and adding display:none to the relevant css class: .geoposition-search { …
Alejandro Veintimilla
  • 10,743
  • 23
  • 91
  • 180
1
vote
1 answer

Django raises PostGISSpatialRefSys matching query does not exist error

I'm using Django and PostGIS to search users with some distance to a certain point. The abstract code is here: class User(AbstractUser): geo = PointField(null=True, srid=4326) objects = GeoManager() Then run this in shell: u =…
Kane Blueriver
  • 4,170
  • 4
  • 29
  • 48
0
votes
0 answers

Django pointfield admin widget shows wrong point (long/lat switch places)

I have a model with PointField. class Companion(models.Model): startpoint = models.PointField(srid=4326, null=True) My admin.py file class CompanionAdmin(admin.GISModelAdmin): pass admin.site.register(Companion, CompanionAdmin) When I set…
0
votes
1 answer

Is there an up to date Django geolocation module that can give me countries using IP?

Is there something as simple as plug in the code and go for geolocation? I only want countries so that my website can switch to the appropriate language. It seems that the ones I found are either deprecated, have less than 10 users, are paid/trial…
1
2