Comments (12)
it should - have you run your database migrations?
from django-google-maps.
yes, I have even flush and erase migrations to start fresh.
from django-google-maps.
can you show what your model looks like? The tests pass under the versions you're using. https://travis-ci.org/github/madisona/django-google-maps
from django-google-maps.
Models.py uses:
from django.db import models
from django_google_maps import fields as map_fields
class Location(models.Model):
address = map_fields.AddressField(max_length=200)
geolocation = map_fields.GeoLocationField(max_length=100)
and admin uses:
from django.contrib import admin
from django_google_maps import widgets as map_widgets
from django_google_maps import fields as map_field
class LocationAdmin(admin.ModelAdmin):
formfield_overrides = {
map_fields.AddressField: {'widget': map_widgets.GoogleMapsAddressWidget},
}
from django-google-maps.
Full Models for your test:
from django.db import models
from django_google_maps import fields as map_fields
class Subscriber(models.Model):
login = models.CharField(max_length=200, unique=True)
email = models.CharField(max_length=200, unique=True)
country = models.CharField(max_length=100)
def __str__(self):
return self.email
class Location(models.Model):
address = map_fields.AddressField(max_length=200)
geolocation = map_fields.GeoLocationField(max_length=100)
class Video(models.Model):
video_title = models.CharField(max_length=200)
video_url = models.CharField(max_length=255, unique=True)
video_file = models.CharField(max_length=50)
video_date = models.DateTimeField('date published')
video_user = models.ForeignKey(Subscriber, on_delete=models.CASCADE)
loc = models.ForeignKey(Location, on_delete=models.CASCADE)
def __str__(self):
return self.video_title + " / " + self.video_file
and full admin:
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 Video, Subscriber, Location
class VideoAdmin(admin.ModelAdmin):
fields = [ 'video_title', 'video_user', 'video_date', 'video_url', 'video_file' ]
class LocationAdmin(admin.ModelAdmin):
formfield_overrides = {
map_fields.AddressField: {'widget': map_widgets.GoogleMapsAddressWidget},
}
admin.site.register(Location, LocationAdmin)
admin.site.register(Video, VideoAdmin)
admin.site.register(Subscriber)
from django-google-maps.
and can you from the DBShell desc
the location table to make sure it exists in the database?
from django-google-maps.
;
+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(100) | NO | | NULL | |
| gps | point | NO | MUL | NULL | |
| address | varchar(100) | NO | | NULL | |
| city | varchar(50) | NO | | NULL | |
+---------+--------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
from django-google-maps.
Ok - there isn't a field called geolocation
which is why you're getting the error. Exception Value: (1054, "Unknown column 'wbmap_location.geolocation' in 'field list'")
from django-google-maps.
ok, so you mean my field gps should be renamed geolocation to work? I give a try.
from django-google-maps.
Ok, after erasing by hand all migrations, databas, table, caches, ... I've recreated the models, with geolocation in name of the field and the admin works almost. The map does not appears (maybe a bad Gmap key? to be checked). Thanks.
from django-google-maps.
OK, now it works.
Static files were missing. As I've installed through pip, i thought everything would come in the right place. After creating folder for static, it's okay now.
Thanks for your help.
from django-google-maps.
you bet - good luck with your project
from django-google-maps.
Related Issues (20)
- Map not Loading on the template HOT 10
- Is it possible to get country, city, zip code fields auto filed like the geocode? HOT 1
- On mouse click set marker with lat long HOT 3
- Plan on Django3 HOT 4
- Plan on Django3.1 HOT 1
- ValueError while trying to migrate app HOT 3
- Error in Django 2.2.16
- Use another name than geolocation HOT 1
- delete
- How could the CSS styles be modified?
- Is there an example (or step to step tutorial) on how to use it? HOT 3
- Django admin AddressField not responsive HOT 1
- Having only the 'address' field in the form.py breaks the search in a template HOT 3
- Django 3.2 support HOT 1
- force_text() is deprecated in favor of force_str() HOT 1
- Issue with the documentation HOT 1
- Django 4.0 force_text HOT 3
- I have custom dashboard and map not loading.
- Widget template renders improperly inside a div HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-google-maps.