Coder Social home page Coder Social logo

ngaric / django-map-widgets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from erdem/django-map-widgets

0.0 0.0 0.0 6.65 MB

Pluggable map widgets for Django Postgis fields

License: MIT License

Shell 0.69% JavaScript 43.12% Python 34.87% CSS 11.92% HTML 8.93% Dockerfile 0.48%

django-map-widgets's Introduction

Coverage Status Build Status PyPI version

Django Map Widgets

Configurable, pluggable and more user friendly map widgets for Django PostGIS fields.

Achievements

The aim of the Django map widgets is to make all Geo Django widgets more user-friendly and configurable.

Django map widgets package has support for Mapbox and Google Map services currently, if you want to see more widgets and think you can help, feel free to contribute to the project.
We would be happy to review and merge your contributions. :)

Installation

pip install django-map-widgets

Add ‘map_widgets’ to your INSTALLED_APPS in settings.py

INSTALLED_APPS = [
     ...
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'mapwidgets',
]

Collects the static files into STATIC_ROOT.

python manage.py collectstatic

Django Admin

from django.contrib.gis.db import models
from mapwidgets.widgets import GooglePointFieldWidget


class CityAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.PointField: {"widget": GooglePointFieldWidget}
    }

Django Forms

from mapwidgets.widgets import GooglePointFieldWidget, GoogleStaticOverlayMapWidget


class CityForm(forms.ModelForm):

    class Meta:
        model = City
        fields = ("coordinates", "city_hall")
        widgets = {
            'coordinates': GooglePointFieldWidget,
            'city_hall': GoogleStaticOverlayMapWidget,
        }

...and your template should look something like this

<form method="POST" action="">
    {% csrf_token %}
    {{form.media}}
    {{form.as_p}}
</form>

Requirements

Django Map Widgets needs Jquery dependency to work in your regular views. In Django Admin case, you don't need to provide the jQuery. Just add map widgets to your django admin forms.

Screenshots

Google Map Point Field Widget

MapBox Map Point Field Widget

Google Map Static Overlay Widget

This widget is working with Magnific Popup jQuery plugin.

Release Notes

0.4.2

  • GooglePointFieldInlineWidget bug fixes for Django 4.2.x (#142), thanks for @isarota.
  • Added .readthedocs.yaml to cover new Read the Docs updates.

0.4.1

  • Added scroll wheel zooming functionality switch to Google Point Map Settings. (#134)
  • Added Chinese(ZH) localisation support. (#133)

0.4.0

  • Supported MapBox Map for Django Geo Point Field.
  • Fixed undefined place object binding issue in javascript triggers. (#125)
  • Documented MapBox point field map widget features.
  • Updated various localize files.

0.3.3

0.3.2

0.3.1

  • Removed six package usages. (#117)
  • Added a new general widget setting in order to specify Google JS libraries. (#119)
  • Implemented some improvements for the demo project.

0.3.0

  • Implemented a new demo project with Django 2.x.
  • Fixed Django Admin jQuery conflicts. (#100)
  • Fixed a new widget JS instance initialising issue for Django Admin Inlines. (#84)
  • Added Python 3.8 env settings to TravisCI configuration.

See release notes for all versions.

django-map-widgets's People

Contributors

erdem avatar polyn0m avatar eriktelepovsky avatar ron8mcr avatar tuky avatar eeriksp avatar emibcn avatar sinanm89 avatar pmontepagano avatar jeasoft avatar hlodver avatar fergusleahytab avatar isarota avatar izaguerreiro avatar mrmikardo avatar janbaykara avatar mbalamut avatar stianjensen avatar a-ershov avatar vtsisyk avatar ybrs avatar safu9 avatar hassanshamim avatar emre avatar dudanogueira avatar danthedeckie avatar dryan avatar bahattincinic avatar dadokkio avatar iamkhush avatar

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.