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