I am new to django. I need a google map in my model. 1. I tried using django-google-maps.my models.py:
from django.db import models from django_google_maps import fields as map_fields class Rental(models.Model): address = map_fields.AddressField(max_length=200) geolocation = map_fields.GeoLocationField(max_length=200)
and my admin.py:
from django.contrib import admin from django_google_maps import widgets as map_widgets from django_google_maps import fields as map_fields from .models import Rental class RentalAdmin(admin.ModelAdmin): formfield_overrides = { map_fields.AddressField: {'widget': map_widgets.GoogleMapsAddressWidget}, } admin.site.register(Rental, RentalAdmin)
but when I click on the map in the admin interface, the fields are still empty. I used this guide to install https://github.com/madisona/django-google-maps
2. I tried to use the light map in this guide http://pypi.python.org/pypi/django-easy-maps , but I do not see the address view in the admin interface. my admin.py:
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)
nim4n source share