Coder Social home page Coder Social logo

silentsokolov / django-treasuremap Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 5.0 504 KB

django-treasuremap app, makes it easy to store and display the location on the map using different providers (Google, Yandex).

License: MIT License

JavaScript 13.80% Python 81.32% HTML 1.14% Makefile 3.74%
django google-maps location python yandex-maps

django-treasuremap's People

Contributors

arkadybag avatar silentsokolov 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

Watchers

 avatar  avatar  avatar  avatar

django-treasuremap's Issues

ImportError: No module named 'treasuremap.backends'

Hi, I'm new on Python/Django so I'm sorry if this is an obvious question.

I followed the install and configuration guide but the project raise this exception: ImportError: No module named 'treasuremap.backends'

I have no folder 'backends' after install treasuremap

map

How can I solve this???

If I add the folder 'backends' I get this error:

django.core.exceptions.ImproperlyConfigured: 'django.db.treasuremap_backends.postgresql_psycopg2' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named 'django.db.treasuremap_backends'

I'm using:
Django 1.7
Python 3.4.2
PostgreSQL 0.9

Не загружается js

Файлы:
https://github.com/silentsokolov/django-treasuremap/blob/master/treasuremap/backends/yandex.py
https://github.com/silentsokolov/django-treasuremap/blob/master/treasuremap/backends/google.py

Ошибка:
'module' object has no attribute 'urlencode'

Причина:
urllib has been split up in Python 3. The urllib.urlencode() function is now urllib.parse.urlencode(), and the urllib.urlopen() function is now urllib.request.urlopen()

https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode

How can I get latitude and longitude data separately from LatLongField in django model?

Hi Sokolov;
How can I get latitude and longitude data separately from LatLongField in django model?
example my models:

from django.db import models
from treasuremap.fields import LatLongField
from django.contrib.auth.models import User

class ShopModel(models.Model):
    name = models.CharField(max_length=100)
    point = LatLongField(blank=True)
    user = models.OneToOneField (User)

How should I query my database?something like this is possible;

latitude = ShopModel.objects.filter(user = request.user, point.latitude = mylatitude)
longitude = ShopModel.objects.filter(user = request.user, point.longitude = mylongitude)

Typos in README.rst and yandex.py

Hello.
I found several typos in following files:

  1. README.rst
    https://github.com/silentsokolov/django-treasuremap/tree/master#in-admin
from treasuremap.widgets import AdminMapWidget
...
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
    def formfield_for_dbfield(self, db_field, **kwargs):
        if db_field.name == 'point':
            kwargs['widget'] = widgets.AdminMapWidget()

Since we imported AdminMapWidget directly, the last line should be:

kwargs['widget'] = AdminMapWidget()
  1. yandex.py
    https://github.com/silentsokolov/django-treasuremap/blob/master/treasuremap/backends/yandex.py
class YandexMapBackend(BaseMapBackend):
   ...
    def get_api_js(self):
        params = OrderedDict()
        params["lang"] = settings.LANGUAGE_CODE

        if self.API_KEY:
            params["pikey"] = self.API_KEY

There is a typo in the name of the dictionary key.
The last line should be:

params["apikey"] = self.API_KEY

Thanks for the package. It was my first time working with Yandex maps and spatial data. Your package helped me a lot.

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.