showing googlemaps in company admin
This commit is contained in:
@@ -56,6 +56,7 @@ INSTALLED_APPS = [
|
||||
'tagulous',
|
||||
'anymail',
|
||||
'storages',
|
||||
'mapwidgets',
|
||||
|
||||
# local apps
|
||||
'core',
|
||||
@@ -159,3 +160,13 @@ TAXONOMY_FILE = 'shop-taxonomy.es-ES.txt'
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = BASE_DIR + '/../media/'
|
||||
GEOIP_PATH = BASE_DIR + '/../datasets/'
|
||||
|
||||
MAP_WIDGETS = {
|
||||
"GooglePointFieldWidget": (
|
||||
("zoom", 6),
|
||||
("mapCenterLocationName", "madrid"),
|
||||
("GooglePlaceAutocompleteOptions", {'componentRestrictions': {'country': 'es'}}),
|
||||
("markerFitZoom", 12),
|
||||
),
|
||||
"GOOGLE_MAP_API_KEY": os.getenv('GOOGLE_MAP_API_KEY')
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib.gis.db.models import PointField
|
||||
|
||||
from mapwidgets.widgets import GooglePointFieldWidget
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -9,5 +12,9 @@ class CompanyAdmin(admin.ModelAdmin):
|
||||
list_filter = ('platform', 'sync', 'is_validated', 'is_active', 'city')
|
||||
search_fields = ('short_name', 'company_name', 'email', 'url')
|
||||
|
||||
formfield_overrides = {
|
||||
PointField: {"widget": GooglePointFieldWidget}
|
||||
}
|
||||
|
||||
|
||||
admin.site.register(models.Company, CompanyAdmin)
|
||||
|
||||
@@ -51,7 +51,7 @@ class Company(models.Model):
|
||||
# internal
|
||||
created = models.DateTimeField('date of creation', auto_now_add=True)
|
||||
updated = models.DateTimeField('date last update', auto_now=True)
|
||||
creator = models.ForeignKey('core.CustomUser', on_delete=models.DO_NOTHING, null=True, related_name='creator')
|
||||
creator = models.ForeignKey('core.CustomUser', on_delete=models.DO_NOTHING, null=True, blank=True, related_name='creator')
|
||||
# history = models.ForeignKey(HistorySync, null=True, on_delete=models.DO_NOTHING, related_name='company')
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -13,3 +13,5 @@ AWS_SECRET_ACCESS_KEY_SES = ''
|
||||
# WooCommerce test credentials
|
||||
WC_KEY = ''
|
||||
WC_SECRET = ''
|
||||
# GOOGLE MAPS
|
||||
GOOGLE_MAP_API_KEY = ''
|
||||
@@ -16,6 +16,7 @@ geoip2==4.1.0
|
||||
woocommerce==2.1.1
|
||||
django-autocomplete-light==3.8.2
|
||||
# manually install `pip install --default-timeout=100 future` to avoid wcapi to timeout
|
||||
django-map-widgets==0.3.0
|
||||
# required for production
|
||||
django-anymail[amazon_ses]==8.2
|
||||
boto3==1.17.11
|
||||
|
||||
Reference in New Issue
Block a user